That works fine on Mac OS X 10.3.9 Tim On 25 Apr 2005, at 8:49 pm, Rayson Ho wrote: > #include <sys/types.h> > #include <sys/stat.h> > #include <unistd.h> > #include <fcntl.h> > > main() > { > int fd, ret, size; > char s[1024]; > struct stat buf; > > fd = open("/tmp/log.txt", O_CREAT|O_WRONLY|O_TRUNC); > > size = sprintf(s, "%d\n", fd); > > write(fd, s, size); > > if (ret = fstat(0, &buf)) > { > size = sprintf(s, "fail: %d\n", ret); > write(fd, s, size); > } > > if (ret = fstat(1, &buf)) > { > size = sprintf(s, "fail2: %d\n", ret); > write(fd, s, size); > } > > if (ret = fstat(2, &buf)) > { > size = sprintf(s, "fail3: %d\n", ret); > write(fd, s, size); > } > } > -- Dr Tim Cutts Informatics Systems Group, Wellcome Trust Sanger Institute GPG: 1024D/E3134233 FE3D 6C73 BBD6 726A A3F5 860B 3CDD 3F56 E313 4233