Date: Tue, 6 Oct 98 19:37 +0100 From: Justin Murdock <justin@vide.coventry.ac.uk> To: questions@FreeBSD.ORG Subject: Help! FreeBSD 2.2.7 error?; fstat/stat Message-ID: <199810061837.TAA24511@mascarpone.coventry.ac.uk>
next in thread | raw e-mail | index | archive | help
Perhaps I'm missing something, but on my (reasonably) freshly installed 2.2.7 (CD set) box #include <stdio.h> #include <sys/stat.h> #include <errno.h> #include <fcntl.h> main (int argc, char **argv ) { int myfd; struct stat mysb; struct stat myfdsb; if (argc!=2) { printf ("usage: %s <file>", argv[0]); exit (EINVAL); } stat(argv[1], &mysb); myfd=open(argv[1], O_RDONLY); fstat(myfd, &myfdsb); printf("%s: %d, %d\n", argv[1], mysb.st_size, myfdsb.st_size); } produces a binary that does this: % ./a.out /usr/home/jlocal/a.out /usr/home/jlocal/a.out: 8808, 0 My expectaton would be for both numbers to be 8808 What am I doing wrong? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810061837.TAA24511>