Mail Archives: cygwin/1999/07/11/15:32:16
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[1],"rb");
> long length = filelength(fileno(datamatfile));
>
Sorry, but a line doesn't tell me anything at all about the rest of your
code.
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.
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
const char *fname = (argc == 2) ? argv[1] : NULL;
FILE *fp;
long fsize;
if (fname == NULL)
{
fprintf (stderr, "Usage: %s filename\n", argv[0]);
exit (1);
}
fp = fopen (fname, "rb");
if (fp == NULL)
{
perror (fname);
exit (1);
}
fsize = filelength (fileno (fp));
printf ("%s: size = %ld\n", fname, fsize);
fclose (fp);
exit (0);
}
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -