Date: Tue, 30 Jun 2009 20:21:03 +0200 (CEST) From: Alexander Best <alexbestms@math.uni-muenster.de> To: <rick-freebsd2008@kiwi-computer.com> Cc: freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays Message-ID: <permail-20090630182103f7e55a9d0000355c-a_best01@message-id.uni-muenster.de> In-Reply-To: <20090630181121.GA32665@keira.kiwi-computer.com>
next in thread | previous in thread | raw e-mail | index | archive | help
thanks. now the output gets redirected using >. i'm quite new to programming under unix. sorry for the inconvenience. so i guess there is no really easy way to output an inhomogeneous struct to stdout without using a loop to output each array contained in the struct. cheers. Rick C. Petty schrieb am 2009-06-30: > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?permail-20090630182103f7e55a9d0000355c-a_best01>