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 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 78611BB84 for ; Thu, 28 Aug 2008 18:01:38 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtEEABVptkiK54gDWGdsb2JhbACSNQEbIacZgWo X-IronPort-AV: E=Sophos;i="4.32,287,1217800800"; d="scan'208";a="28590310" Received: from rouge.crans.org ([138.231.136.3]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Aug 2008 18:01:34 +0200 Received: from localhost (localhost.crans.org [127.0.0.1]) by rouge.crans.org (Postfix) with ESMTP id 4CCA682E8; Thu, 28 Aug 2008 18:01:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at crans.org Received: from rouge.crans.org ([10.231.136.3]) by localhost (rouge.crans.org [10.231.136.3]) (amavisd-new, port 10024) with LMTP id 6Y7tuStAhaFC; Thu, 28 Aug 2008 18:01:33 +0200 (CEST) Received: from [88.185.141.188] (korell.glondu.net [88.185.141.188]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rouge.crans.org (Postfix) with ESMTP id E715182E7; Thu, 28 Aug 2008 18:01:32 +0200 (CEST) Message-ID: <48B6CBDC.9000702@glondu.net> Date: Thu, 28 Aug 2008 18:01:32 +0200 From: =?UTF-8?B?U3TDqXBoYW5lIEdsb25kdQ==?= User-Agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: Jan Kybic Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Run-time evaluation of a Printf format string References: <87hc951cr9.fsf@fel.cvut.cz> In-Reply-To: <87hc951cr9.fsf@fel.cvut.cz> X-Enigmail-Version: 0.95.0 OpenPGP: id=FCE03DAA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; run-time:01 printf:01 printf:01 sprintf:01 %03:01 ocaml:01 pervasives:01 scanf:01 cheers:01 phane:98 steph:98 img:98 phane:98 wrote:01 caml-list:01 Jan Kybic wrote: > I would need an equivalent of Printf.sprintf where the=20 > format string is not constant, it is read from the command line. > The motivation is to let the user specify a template for file names, > such as "img%03d.png". Can this be achieved in Ocaml? It seems not, as = > Pervasives.string_of_format only accepts constant strings. > Or is there some external library useful for this task? What about Scanf.format_from_string? Cheers, --=20 St=C3=A9phane