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.0 required=5.0 tests=none 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 5E713BC68 for ; Sat, 11 Nov 2006 21:56:57 +0100 (CET) Received: from home.mk.pp.ru (av6800.comex.ru [217.10.34.155]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kABKuuSk019032 for ; Sat, 11 Nov 2006 21:56:57 +0100 Received: from ermine.home (ermine.home [192.168.2.2]) by home.mk.pp.ru (Postfix) with ESMTP id 0DD7220AB9; Sat, 11 Nov 2006 23:56:56 +0300 (MSK) Received: by ermine.home (Postfix, from userid 1001) id 732B43A9CD0; Sat, 11 Nov 2006 23:59:18 +0300 (MSK) Date: Sat, 11 Nov 2006 23:59:18 +0300 From: Anastasia Gornostaeva To: Peter Gregory Cc: caml-list@inria.fr Subject: Re: [Caml-list] printf and positional specifier Message-ID: <20061111205918.GA14565@ermine.home> References: <20061111201226.GA14282@ermine.home> <4556342C.10109@cis.strath.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <4556342C.10109@cis.strath.ac.uk> User-Agent: Mutt/1.5.11 X-Miltered: at discorde with ID 45563918.003 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; printf:01 specifier:01 printf:01 specifier:01 flags:01 wrote:01 char:01 caml-list:01 integer:01 integer:01 argument:02 argument:02 width:97 parameters:02 string:02 On Sat, Nov 11, 2006 at 08:35:56PM +0000, Peter Gregory wrote: > ># printf "%2$d %1$s" "abc" 2;; > >Bad conversion %$, at char number 0 in format string ``%2$d %1$s'' > 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. >>From documentation on Printf module: Conversion specifications have the following form: % [positional specifier] [flags] [width] [.precision] type The optional positional specifier consists of an integer followed by a $; the integer indicates which argument to use, the first argument being denoted by 1. ermine