> -----Original Message-----
> From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
> questi...@freebsd.org] On Behalf Of Gary Kline
> Sent: Wednesday, December 28, 2011 3:50 PM
> To: FreeBSD Mailing List
> Subject: how to tell that a file exists and is not 0-len?
> 
> 
> 
> guys,
> 
> 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?

This should do:

#include <sys/types.h>
#include <sys/stat.h>
...
struct stat sb;
off_t size;
if (!lstat(pathbuf, &sb)) size = sb.st_size;
...

-- 
Devin

_____________
The information contained in this message is proprietary and/or confidential. 
If you are not the intended recipient, please: (i) delete the message and all 
copies; (ii) do not disclose, distribute or use the message in any manner; and 
(iii) notify the sender immediately. In addition, please be aware that any 
message addressed to our domain is subject to archiving and review by persons 
other than the intended recipient. Thank you.
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to