This is the mail archive of the
mailing list for the Cygwin project.
Re: filesize function
- To: Reza Habib <email@example.com>
- Subject: Re: filesize function
- From: Mumit Khan <firstname.lastname@example.org.EDU>
- Date: Sun, 11 Jul 1999 14:30:32 -0500 (CDT)
- cc: Cygwin Mailing List <email@example.com>
On Sat, 10 Jul 1999, Reza Habib wrote:
> Hi. I'm using the filesize function from io.h on mingw32 with egcs 1.1.2.
> The size reported by the function is incorrect. The exact same line reports
> the correct value with either visual c++ or borland c++. Is this a bug in
> the mingw32 library? Here is the line:
> FILE *datamatfile = fopen(argv,"rb");
> long length = filelength(fileno(datamatfile));
Sorry, but a line doesn't tell me anything at all about the rest of your
I tried out the following program and it gives me the same result as MSVC
and what-not. If you can provide a complete testcase showing the problem,
I'll look at it.
$ gcc -g -Wall -o file-length-test.exe file-length-test.c
$ file-length-test file-length-test.c
and see what size you get.
== cut from here to end.
main (int argc, char *argv)
const char *fname = (argc == 2) ? argv : NULL;
if (fname == NULL)
fprintf (stderr, "Usage: %s filename\n", argv);
fp = fopen (fname, "rb");
if (fp == NULL)
fsize = filelength (fileno (fp));
printf ("%s: size = %ld\n", fname, fsize);
Want to unsubscribe from this list?
Send a message to firstname.lastname@example.org