c question: *printf'ing arrays
Alexander Best
alexbestms at math.uni-muenster.de
Tue Jun 30 18:03:35 UTC 2009
should be stdout.
struct Header *hdr = rom;
int new_fd = open("/dev/stdout", O_RDWR);
printf("SIZE: %d\n",sizeof(*hdr));
write(new_fd, hdr, sizeof(*hdr));
close(new_fd);
Igor Mozolevsky schrieb am 2009-06-30:
> 2009/6/30 Alexander Best <alexbestms at math.uni-muenster.de>:
> > that works, but i really want to have a pretty output to stdout. i
> > guess i
> > have to stick with printf and use `for (i=0; i < sizeof(XXX); i++)`
> > for each
> > array in the struct. just thought i could avoid it.
> > btw. `./my-program | hexdump` works, but if i do `./my-program >
> > output`
> > output is being created, but is empty. is this normal?
> Depends if you output to stdout or stderr --- `>' redirects stdout.
> Cheers,
> --
> Igor
More information about the freebsd-hackers
mailing list