latest release trouble using stat() with -mno-cygwin flag

NOE Nicolas n.noe@cstb.fr
Tue Jan 9 02:31:00 GMT 2001


Hello, 

I use stat() from sys/stat.h to get a file size in a C program,
compiling with -mno-cygwin flag. It used to work before I updated
to latest releases (cygwin, gcc and mingw), but now the stat
structure seems to be melted, since I always get 4 as st_size, and
that the real size seems to be in the st_atime field ! By the way,
everything works fine without -mno-cygwin flag.

Maybe I should ask my question on the mingw list, but I don't know
if the mingw included in cygwin distribution is just a copy of the
latest mingw release or if some things are changed. If the bug
comes from a faulty mingw, is there a safe way to remove my current
one (mingw-20001225-1.tar.gz) and reinstall a previous one ?

I use the command line : gcc -mno-cygwin -o stat stat.c and my test
program is the following (stat.c) :

#include <stdlib.h>
#include <stdio.h>

#include <sys/stat.h>

int main(int argc, char *argv[])
{
    	int		i;
	struct stat	buf;
	
	for (i = 1; i < argc; i++)
	    	if (stat(argv[i], &buf))
		    	fprintf(stderr, "stat(): error\n");
		else
			printf("%s size is %d\n", argv[i], buf.st_size);

	return 0;
}

Nicolas Noe (n.noe@cstb.fr)

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list