Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com X-Authentication-Warning: mercury.xraylith.wisc.edu: khan owned process doing -bs Date: Sun, 11 Jul 1999 14:30:32 -0500 (CDT) From: Mumit Khan To: Reza Habib cc: Cygwin Mailing List Subject: Re: filesize function In-Reply-To: <000a01becae1$ad4d01b0$d28e94d1@newton> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 #include #include 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