To: dnelson AT quake DOT xnet DOT com (Dan Nelson) Cc: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp) Subject: Re: filesize() equivalent? Date: Sun, 11 Dec 94 11:59:09 +0200 From: "Eli Zaretskii" > This is probably a FAQ somewhere, but what IS the preferred way to find > filesize? lseek() to EOF, or a fstat() call? The Borland version of > fstat() does the seek() internally. So for Borland (and therefore, this > version of gcc), lseek() seems to be better. The version of fstat() in libc.a which comes with DJGPP 1.12m2 does a terrible job. This isn't a DJGPP's problem, its fstat() just jumps to the go32 extender which calls fstat() from the Turbo C library. The file's size is about the only thing it brings correctly, though. Take a look at the version I've written (ftp://omnigate.clarkson.edu: /pub/msdos/djgpp/pub/djstat02.zip). It also includes a separate function named filelength() which does exactly what its Borland's namesake does. Btw, seek() and lseek() are the same under DOS, AFAIK.