From owner-freebsd-questions@FreeBSD.ORG Fri Apr 28 14:01:21 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3D0FE16A403 for ; Fri, 28 Apr 2006 14:01:21 +0000 (UTC) (envelope-from conrads@cox.net) Received: from eastrmmtao03.cox.net (eastrmmtao03.cox.net [68.230.240.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id EABDF43D5D for ; Fri, 28 Apr 2006 14:01:19 +0000 (GMT) (envelope-from conrads@cox.net) Received: from serene.no-ip.org ([72.200.25.154]) by eastrmmtao03.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20060428140115.EMQY15797.eastrmmtao03.cox.net@serene.no-ip.org>; Fri, 28 Apr 2006 10:01:15 -0400 Received: from localhost (localhost [127.0.0.1]) by serene.no-ip.org (8.13.6/8.13.6) with ESMTP id k3SE12j3019436; Fri, 28 Apr 2006 09:01:02 -0500 (CDT) (envelope-from conrads@cox.net) Date: Fri, 28 Apr 2006 09:00:57 -0500 From: "Conrad J. Sabatier" To: "Conrad J. Sabatier" Message-ID: <20060428090057.304a67ee@localhost> In-Reply-To: <20060428081734.67014428@localhost> References: <40b94f630604280122v72c432dfx2f3c2e11a220a82e@mail.gmail.com> <20060428081734.67014428@localhost> Organization: A Rag-Tag Band of Drug-Crazed Hippies X-Mailer: Sylpheed-Claws 2.1.1 (GTK+ 2.8.17; amd64-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org, jiangyong jon7808 Subject: Re: gcc problem, I can't get the 'ctime(&(statbuf.st_atime)' value in line20. 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: Fri, 28 Apr 2006 14:01:22 -0000 On Fri, 28 Apr 2006 08:17:34 -0500, "Conrad J. Sabatier" wrote: > On Fri, 28 Apr 2006 16:22:10 +0800, "jiangyong jon7808" > wrote: > > > 1 #include > > 2 #include > > 3 char *filename = "/etc/passwd" ; > > 4 > > 5 int main() > > 6 { > > 7 struct stat statbuf; > > 8 > > 9 if(stat(filename,&statbuf)==-1) > > 10 { > > 11 printf("Get stat on %s Error:%s\n", > > filename,strerror(errno)); > > 12 return(-1); > > 13 } > > 14 > > 15 printf("Filename: %s\n", filename); > > 16 printf("Size: %ld\n", statbuf.st_size); > > 17 printf("Access Date: %s", ctime(&(statbuf.st_atime))); > > 18 > > 19 printf("%s size: bytes\taccessed at %s", > > filename,ctime(&statbuf.st_atime)); > > 20 printf("%s size:%ld bytes\taccesed at %s", filename, > > statbuf.st_size,ctime(&(statbuf.st_atime))); > > 21 printf("\n**********************The > > end!*************************\n") ; > > 22 } > > > > > > > > > > > > OS :FreeBSD 6.1-RC #36 > > Works fine here: > > $ ./foo > Filename: /etc/passwd > Size: 6073 > Access Date: Wed Apr 26 04:07:15 2006 > /etc/passwd size: bytes accessed at Wed Apr 26 04:07:15 2006 > /etc/passwd size:6073 bytes accessed at Wed Apr 26 04:07:15 2006 > > **********************The end!************************* Hmm, I just noticed the missing data above. My bad. :-) -- Conrad J. Sabatier -- "In Unix veritas"