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.4 required=5.0 tests=DNS_FROM_RFC_POST autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 1127FBC68 for ; Sat, 11 Nov 2006 21:53:03 +0100 (CET) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kABKqwY5001396 for ; Sat, 11 Nov 2006 21:53:02 +0100 Received: from db2.internal (db2.internal [10.202.2.12]) by frontend1.messagingengine.com (Postfix) with ESMTP id 8E4C8DC347D; Sat, 11 Nov 2006 15:52:50 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by db2.internal (MEProxy); Sat, 11 Nov 2006 15:52:52 -0500 X-Sasl-enc: rS8QOE/DkjVb6RnEnrIFyvZEZFoahjmQYsUt78Y+9aRp 1163278372 Received: from adsl-75-26-47-5.dsl.sndg02.sbcglobal.net (adsl-75-26-47-5.dsl.sndg02.sbcglobal.net [75.26.47.5]) by mail.messagingengine.com (Postfix) with ESMTP id ABD26FA4B; Sat, 11 Nov 2006 15:52:50 -0500 (EST) Date: Sat, 11 Nov 2006 12:52:43 -0800 (PST) From: Martin Jambon X-X-Sender: martin@droopy To: Peter Gregory Cc: ermine@ermine.pp.ru, caml-list@inria.fr Subject: Re: [Caml-list] printf and positional specifier In-Reply-To: <4556342C.10109@cis.strath.ac.uk> Message-ID: References: <20061111201226.GA14282@ermine.home> <4556342C.10109@cis.strath.ac.uk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-j-chkmail-Score: MSGID : 4556382A.000 on concorde : j-chkmail score : X : 0/20 1 X-Miltered: at concorde with ID 4556382A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; printf:01 specifier:01 ocaml:01 printf:01 fprintf:01 libref:01 1977:98 wrote:01 wrote:01 char:01 caml-list:01 jambon:01 jambon:01 caml:02 caml:02 On Sat, 11 Nov 2006, Peter Gregory wrote: > Anastasia Gornostaeva wrote: >> Hello. >> >> $ ocaml >> Objective Caml version 3.09.3 >> >> # open Printf;; >> # printf "%2$d %1$s" "abc" 2;; >> Bad conversion %$, at char number 0 in format string ``%2$d %1$s'' >> >> >> How? >> >> ermine >> > > Hi Ermine, > > I'm not sure that I understand your question. I think to achieve what you > seem to be trying, you would simply write: > > # printf "%d %s" 2 "abc";; > > You just put the parameters in the order they came in the string. Does that > help, it seems like perhaps you needed more than that. The dollar stuff is real, although I have no idea of how to make it work. It's the last paragraph in the description of Printf.fprintf: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html Martin -- Martin Jambon, PhD http://martin.jambon.free.fr