How to print floats with leading blanks instead of leading zeros using sprintf?



Hi everyone,

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".
However gnuplot outputs:
sprintf(' %3.0f',1) "001"
sprintf(' %3.0d',1) "1" (without leading blanks).

Does anyone know how to fix this issue?

Thanks in advance!

Regards,
Valera
.



Relevant Pages