From owner-freebsd-questions@FreeBSD.ORG Wed Dec 28 23:59:26 2011 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1CB8106567C for ; Wed, 28 Dec 2011 23:59:26 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 7AC008FC08 for ; Wed, 28 Dec 2011 23:59:26 +0000 (UTC) Received: from pps.filterd (ltcfislmsgpa07 [127.0.0.1]) by ltcfislmsgpa07.fnfis.com (8.14.4/8.14.4) with SMTP id pBSNQvKI014611; Wed, 28 Dec 2011 17:59:25 -0600 Received: from smtp.fisglobal.com ([10.132.206.17]) by ltcfislmsgpa07.fnfis.com with ESMTP id 120cr4g2ks-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 28 Dec 2011 17:59:25 -0600 Received: from dtwin (10.14.152.15) by smtp.fisglobal.com (10.132.206.17) with Microsoft SMTP Server (TLS) id 14.1.323.3; Wed, 28 Dec 2011 17:59:24 -0600 From: Devin Teske To: "'Gary Kline'" , "'FreeBSD Mailing List'" References: <20111228235010.GA28763@thought.org> In-Reply-To: <20111228235010.GA28763@thought.org> Date: Wed, 28 Dec 2011 15:59:33 -0800 Message-ID: <032401ccc5bc$bf645950$3e2d0bf0$@fisglobal.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGT3xT8feIqbiSk3I8fOSI2y4xLA5ZjuYlw Content-Language: en-us X-Originating-IP: [10.14.152.15] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110, 1.0.211, 0.0.0000 definitions=2011-12-28_08:2011-12-28, 2011-12-28, 1970-01-01 signatures=0 Cc: Subject: RE: how to tell that a file exists and is not 0-len? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2011 23:59:26 -0000 > -----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 #include ... 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.