Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?UTF-8?B?SGFucy1CZXJuaGFyZCBCcsO2a2Vy?= Newsgroups: comp.graphics.apps.gnuplot Subject: Re: How to print floats with leading blanks instead of leading zeros using sprintf? Date: Mon, 28 May 2012 23:32:58 +0200 Lines: 24 Message-ID: References: <3d97629a-6d13-4e42-bb08-9a1d05a569d9@vy7g2000pbc.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.dfncis.de OSyRENdehmRcG3cO1iDDfgdl+zUwkxnPk4yMuGAbuL/nHQo369Qp2ZWL4ygAzhqrxRGarXY9Yy Cancel-Lock: sha1:NTZDItc1xWaCIPgt4TaqLQwPDP8= User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120420 Thunderbird/12.0 In-Reply-To: <3d97629a-6d13-4e42-bb08-9a1d05a569d9@vy7g2000pbc.googlegroups.com> Xref: csiph.com comp.graphics.apps.gnuplot:1152 On 28.05.2012 17:09, Валерий Симонов wrote: > I want to specify labels for the plots using sprintf. > According to http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ > sprintf(' %3.0f',1) should print "001" > sprintf(' %3.0d',1) should print " 1". That reference (or your understanding of it) is incorrect, as far as the behaviour of the 'f' format specifier is concerned. > However gnuplot outputs: > sprintf(' %3.0f',1) "001" No, it doesn't. > sprintf(' %3.0d',1) "1" (without leading blanks). > Does anyone know how to fix this issue? What issue, in particular? How come your subject line is about blanks in printing _floats_, but then you only try syntax that you think you should print leading blanks in _integers_?