how to tell that a file exists and is not 0-len?

Matthew Seaman m.seaman at
Wed Dec 28 23:57:27 UTC 2011

On 28/12/2011 23:50, Gary Kline wrote:

> access(filenamewithpath, F_OK) returned true  as Zero if i have
> access to it.  what do i use in C to tell me that a file is not  
> empty?  fstat?  or is there something more common?

stat(2) which uses the file path -- unless you have an open file
descriptor on the file, in which case use fstat(2).


Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP:     Ramsgate
JID: matthew at               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url :

More information about the freebsd-questions mailing list