c question: *printf'ing arrays

Rick C. Petty rick-freebsd2008 at kiwi-computer.com
Tue Jun 30 18:11:23 UTC 2009


On Tue, Jun 30, 2009 at 08:03:21PM +0200, Alexander Best wrote:
> 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);

Why are you reopening stdout?  It should already be open, so use
"fileno(stdout)" or just plain "STDOUT_FILENO" instead of "new_fd".

-- Rick C. Petty


More information about the freebsd-hackers mailing list