1 #include <sys/stat.h> 2 #include <errno.h> 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
_______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"