Re: Can't find right printf format



Hubert Gabler wrote:
Hello,
my problem is very simple, but I cannot find the answer in "Learning
Perl" nor in the manpages:
Which FORMAT in printf makes the numbers 1,2,3,.. look like
001,002,003..? Hubert

%03d

This will give you 3 zero-padding digits (if you remove the zero from
the format, it will be the same width, but space-padded instead.)

--
szr


.



Relevant Pages

  • Re: ES format
    ... >> runtime format, even a runtime format that is trivially constant, not. ... You aren't allowed by Standard C to define any _external_ linkage ... In particular you certainly can define a 'static' function printf(), ... but otherwise it is part of the language and the compiler ...
    (comp.lang.fortran)
  • Re: vscanf and vprintf
    ... They take a pointer to a list of arguments rather than the arguments ... How can I write a function that takes a format string and a variable ... number of arguments, like printf, and passes them to printf to do most ... variable-length argument list, they accept a single va_list pointer. ...
    (comp.lang.c)
  • Re: how does printf handle an unknown number of arguments
    ... When you include stdio.h, you include a prototype for printfthat, ... int printf; ... The method printf() uses is a format string, which has embedded within it, ...
    (comp.lang.c)
  • Re: printf troubles
    ... is not part of the awk language. ... If I read your response correctly, printf cannot accept a variable ... You can have an arbitrary number of arguments (matching to the format ...
    (comp.lang.awk)
  • Re: printf troubles
    ... printf (stmt) ... where stmt is a single string. ... You assume some interpretation of the format string which ... If I read your response correctly, printf cannot accept a variable substitution for the fields to be output? ...
    (comp.lang.awk)