www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/12/10/18:18:34

From: dnelson AT quake DOT xnet DOT com (Dan Nelson)
Subject: Re: filesize() equivalent?
To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp)
Date: Sat, 10 Dec 1994 14:31:47 -0600 (CST)

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019