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=0.2 required=5.0 tests=MISSING_HEADERS autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 32201BC6A for ; Sat, 11 Nov 2006 21:36:18 +0100 (CET) Received: from smtphost.cis.strath.ac.uk (smtphost.cis.strath.ac.uk [130.159.196.96]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kABKaHP9016079 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 11 Nov 2006 21:36:17 +0100 Received: from [10.0.0.17] ([84.13.34.209]) by smtphost.cis.strath.ac.uk (8.13.4/8.13.3/Debian-6) with ESMTP id kABKa3Y0031786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 11 Nov 2006 20:36:03 GMT Message-ID: <4556342C.10109@cis.strath.ac.uk> Date: Sat, 11 Nov 2006 20:35:56 +0000 From: Peter Gregory User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 Cc: caml-list@inria.fr, ermine@ermine.pp.ru Subject: Re: [Caml-list] printf and positional specifier References: <20061111201226.GA14282@ermine.home> In-Reply-To: <20061111201226.GA14282@ermine.home> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-CIS-MailScanner: Found to be clean X-CIS-MailScanner-SpamCheck: not spam, SpamAssassin (score=0.095, required 6, autolearn=disabled, AWL -0.10, MISSING_HEADERS 0.19) X-CIS-MailScanner-From: pg@cis.strath.ac.uk X-Miltered: at discorde with ID 45563441.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; printf:01 specifier:01 ocaml:01 printf:01 wrote:01 char:01 caml-list:01 caml:02 objective:02 parameters:02 string:02 string:02 seems:03 perhaps:04 seem:07 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. Regards, Peter.