Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
printf Width
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The width field contains a non-negative decimal integer that
specifies the minimum number of characters printed.
If the number of characters in the output is less than the
specified width, blanks are added to the left or the right of the
output value (depending on whether the - flag is used) until the
minimum width is reached. If width is prefixed with a 0, zeros are
added until the minimum width is reached. (This is not useful for
left-justified numbers.)
The width specification never causes a value to be truncated. If
the number of characters in the output value is greater than the
specified width, or width is not given, all characters of the
value are printed (subject to the precision specification).
If the width specification is an asterisk (*), the width is
determined by the next argument, which must be an integer. The
width argument must precede the value being formatted in the
argument list.
-♦-