Date: Wed, 28 Dec 2011 15:59:33 -0800 From: Devin Teske <devin.teske@fisglobal.com> To: "'Gary Kline'" <kline@thought.org>, "'FreeBSD Mailing List'" <freebsd-questions@FreeBSD.ORG> Subject: RE: how to tell that a file exists and is not 0-len? Message-ID: <032401ccc5bc$bf645950$3e2d0bf0$@fisglobal.com> In-Reply-To: <20111228235010.GA28763@thought.org> References: <20111228235010.GA28763@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> -----Original Message----- > From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd- > questions@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?032401ccc5bc$bf645950$3e2d0bf0$>