how to tell that a file exists and is not 0-len?
devin.teske at fisglobal.com
Wed Dec 28 23:59:26 UTC 2011
> -----Original Message-----
> From: owner-freebsd-questions at freebsd.org [mailto:owner-freebsd-
> questions at 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?
> access(filenamewithpath, F_OK) returned true as Zero if i have access to it.
> do i use in C to tell me that a file is not empty?
This should do:
struct stat sb;
if (!lstat(pathbuf, &sb)) size = sb.st_size;
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.
More information about the freebsd-questions