Date: Thu, 2 Jul 2009 15:10:58 -0300 From: "Carlos A. M. dos Santos" <unixmania@gmail.com> To: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= <des@des.no> Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org, Alexander Best <alexbestms@math.uni-muenster.de> Subject: Re: c question: *printf'ing arrays Message-ID: <e71790db0907021110l1ba3ee6cuf4f860489a046b3e@mail.gmail.com> In-Reply-To: <864otvax7x.fsf@ds4.des.no> References: <permail-2009063022060580e26a0b00003f4a-a_best01@message-id.uni-muenster.de> <864otvax7x.fsf@ds4.des.no>
next in thread | previous in thread | raw e-mail | index | archive | help
2009/7/2 Dag-Erling Sm=F8rgrav <des@des.no>: > Alexander Best <alexbestms@math.uni-muenster.de> writes: >> =A0 =A0 for (i=3D0; i < sizeof(hdr->nintendo_logo); i++) >> =A0 =A0 =A0 =A0 fprintf(stderr, "%x", hdr->nintendo_logo[i]); > > What will this print if nintendo_logo is { 0x01, 0x02, 0x03, 0x04 }? Good catch. It will print "0x1234" but it should print "0x01020304". My example has the same error. The conversion specification should be "%02x", not just "%x". --=20 My preferred quotation of Robert Louis Stevenson is "You cannot make an omelette without breaking eggs". Not because I like the omelettes, but because I like the sound of eggs being broken.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e71790db0907021110l1ba3ee6cuf4f860489a046b3e>