From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 6D340BC0A for ; Sun, 4 Feb 2007 02:11:45 +0100 (CET) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.225]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l141BiHY015886 for ; Sun, 4 Feb 2007 02:11:45 +0100 Received: by nz-out-0506.google.com with SMTP id l8so1289483nzf for ; Sat, 03 Feb 2007 17:11:44 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uJsHFUzfux1u2zK+ejFNorDTn65SeupVh9no0CQ1NbwjW1d6Qi5vpwSDTwdRHGgmxaXmN30hZM4s6ABntGaPuh4RHq6mzJJCfx/Y8Ga/Lc4qtMhpPfjxet/GIUXvHxK8MdSZpUo3GB5TTpkbGawA8KlXSQSlGnrTiT1R7iIXfeE= Received: by 10.114.153.18 with SMTP id a18mr495076wae.1170551503508; Sat, 03 Feb 2007 17:11:43 -0800 (PST) Received: by 10.115.107.15 with HTTP; Sat, 3 Feb 2007 17:11:43 -0800 (PST) Message-ID: Date: Sun, 4 Feb 2007 14:11:43 +1300 From: "Jonathan Roewen" To: "Oliver Bandel" Subject: Re: [Caml-list] sprintf-Bug? Cc: caml-list@inria.fr In-Reply-To: <20070204010040.GC3829@first.in-berlin.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070204010040.GC3829@first.in-berlin.de> X-j-chkmail-Score: MSGID : 45C532D0.001 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45C532D0.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; byte:01 printf:01 sprintf:01 bandel:01 in-berlin:01 byte:01 printf:01 sprintf:01 val:01 ocaml:01 beginner's:01 ocaml:01 bug:01 beginners:01 wrote:01 Don't think so. I'm pretty sure padding of strings is only with spaces. Padding of numbers has to be specified for a number format. let hex_of_byte b = Printf.sprintf "%02X" b;; Why you'd use two sprintfs is the real oddity =P Jonathan On 2/4/07, Oliver Bandel wrote: > Hello, > > this I explored: > > # let hex_of_byte b = Printf.sprintf "%02s" (Printf.sprintf "%0X" b);; > val hex_of_byte : int -> string = > # hex_of_byte 12;; > - : string = " C" > > Shouldn't the result be "0C" ?! > (I'm using OCaml 3.09.3.) > > > Ciao, > Oliver > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >