Mail Archives: djgpp/1994/12/11/05:42:35
> 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.
- Raw text -