From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 2 18:10:59 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2933106564A for ; Thu, 2 Jul 2009 18:10:59 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 56E218FC14 for ; Thu, 2 Jul 2009 18:10:59 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: by fxm18 with SMTP id 18so1538106fxm.43 for ; Thu, 02 Jul 2009 11:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=HPKM4uBn57Tlz9TqWYG0AyRurmSAirUwY8N6O2kwt40=; b=Szgp7mqQbcCjRWx6JHZBlBGjwdEugSsGNkiMBEs1Sx2v6nl180hlTDeC6llJznanfA OZC3vUigPYvjY8nvt58NDUWPfZ/AE0+JP/2djw7/4XyK2Q8LYyhXxd3WP4eLLs9nvzCK q0lHpub34TjIsVfrKknY5IpsEui33930biBo4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Np0OyXbEo190DL68N1l480Octvz9yjyzzUGYPy9oh8E9lfaCejcJywHaL2jBxB32PV tL/8LNuKYs7TgbcNEhdsv4/YZPqEqLo19WNxq2GNOvH6roqFzUjZlW9dwtMbkX2m5lOc jYMGWR26KWlHfYjRCa3Dk1YTz1VOXnHhW9Df8= MIME-Version: 1.0 Received: by 10.239.168.6 with SMTP id i6mr34452hbe.25.1246558258284; Thu, 02 Jul 2009 11:10:58 -0700 (PDT) In-Reply-To: <864otvax7x.fsf@ds4.des.no> References: <864otvax7x.fsf@ds4.des.no> Date: Thu, 2 Jul 2009 15:10:58 -0300 Message-ID: From: "Carlos A. M. dos Santos" To: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org, Alexander Best Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 18:11:00 -0000 2009/7/2 Dag-Erling Sm=F8rgrav : > Alexander Best 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.