Mail Archives: djgpp/1994/12/10/18:18:34
in the last episode, Steve Blinkhorn said:
>
> Is there a djgpp equivalent to the BCC filesize() function, or does
> one have to use stat()?
BCC doesn't have filesize(). It does have a "long filelength(int handle)",
though. According to the Borland 4.0 source CD, it seeks to EOF, gets file
pos, and seeks back to where it started. It does it via the INT 21h ah=42
"lseek" call, so it's pretty fast.
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.
- Raw text -