HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)
p
printf(3S) printf(3S)
(which they normally are).
0 Leading zeros (following any indication of sign or base) are used to pad to the field width for
all conversion characters. No space padding is performed. If both the
0 and - appear, the
0 flag is ignored. For
d, i, o, u, p, x, and X, conversions, if a precision is specified, the
0
flag is ignored.
The conversion characters and their meanings are:
d,i,o,u
,x,X The integer arg is converted to signed decimal (d and i are identical), unsigned octal
(
o), decimal (u), or hexadecimal notation (
x and X), respectively; the letters
abcdef
are used for x conversion and the letters
ABCDEF for X conversion. The precision
specifies the minimum number of digits to appear. If the value being converted can be
represented in fewer digits, it is expanded with leading zeros. (For compatibility with
older versions, padding with leading zeros can alternatively be specified by inserting a
zero in front of the field width. This does not imply an octal value for the field width).
The default precision is 1. The result of converting a zero value with a precision of
zero is a null string.
f,F The double arg is converted to decimal notation in the style [-
]dddrddd, where r is
the radix character. The number of digits after the radix character is equal to the pre-
cision specification. If the precision is missing, six digits are output. If the precision
is explicitly zero, no radix character appears.
e,E The double arg is converted in the style [-]drddde±
dd, where r is the radix charac-
ter. There is one digit before the radix character and the number of digits after it is
equal to the precision; when the precision is missing, six digits are produced; if the
precision is zero, no radix character appears. The
E format code produces a number
with E instead of e introducing the exponent. The exponent always contains at least
two digits.
g,G The double arg is printed in style f, F,ore
(or in style E in the case of a G format
code), with the precision specifying the number of significant digits. The style used
depends on the value converted: style
e is used only if the exponent resulting from
the conversion is less than -4 or greater than or equal to the precision. Trailing zeros
are removed from the fractional part of the result; a radix character appears only if it
is followed by a digit.
a,A For Itanium(R)-based systems only. The double arg is converted in the style
[
-]0xhrhhhp±d, where r is the radix character. There is one digit before the radix
character and the number of digits after it is equal to the precision; when the preci-
sion is missing, 13 digits are produced for double, 15 for extended, and 28 for
long double (which is sufficient for an exact representation of the value); if the
precision is 0, no radix character appears. The letters abcdef are used for a
conversion and the letters ABCDEF for A conversion. The A conversion specifier
produces a number with X and P instead of x and p. The exponent always contains
at least one digit, and only as many more digits as necessary to represent the decimal
exponent of 2. If the value is zero, the exponent is zero.
c The integer arg is converted to an unsigned char, and the resulting character is
printed. If an l (ell) qualifier is present, the wchar_t arg is converted to an array
of bytes representing the single wide character according to the setting of LC_CTYPE.
Resulting bytes are printed. If the field width would otherwise cause the wide charac-
ter to be split, the wide character is printed and the field width is adjusted upward.
_INCLUDE__STDC_A1_SOURCE only: If an l (ell) qualifier is present, the
wint_t argument is converted as if by an ls conversion specification with no preci-
sion and an argument that points to a two-element array of type wchar_t, the first
element of which contains the wint_t argument to the ls conversion specification
and the second element contains a null wide-character.
C Same as lc.
s The arg is taken to be a string (character pointer) and characters from the string are
printed until a null character (\0) is encountered or the number of bytes indicated by
the precision specification is reached. If the precision is missing, it is taken to be
infinite, so all characters up to the first null character are printed. A NULL value for
arg yields undefined results.
HP-UX 11i Version 3: February 2007 − 3 − Hewlett-Packard Company 135