HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

p
printf(3S) printf(3S)
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 precision 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.
If an l (ell) qualifier is present, the argument must be a pointer to an array of type
wchar_t. Wide-characters from the array are converted to characters (each as if by
a call to the wcrtomb() function, with the conversion state described by an
mbstate_t object initialized to zero before the first wide-character is converted) up
to and including a terminating null wide-character. The resulting characters are writ-
ten up to (but not including) the terminating null character (byte).
If no precision is specified, the array must contain a null wide-character. If a preci-
sion is specified, no more than that many characters (bytes) are written (including
shift sequences, if any), and the array must contain a null wide-character if, to equal
the character sequence length given by the precision, the function would need to
access a wide-character one past the end of the array. In no case is a partial character
written.
S Same as ls.
p The value of a pointer to void arg is printed as a sequence of unsigned hexadecimal
numbers. 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. The default precision is 1. The result of converting a zero value with a preci-
sion of zero is a null string.
n A pointer to an integer arg is expected. This pointer is used to store the number of
bytes printed on the output stream so far by this call to the function. No argument is
converted.
% Print a %; no argument is converted. The entire conversion specification must be %%.
In no case does a nonexistent or small field width cause truncation of a field; if the result of a conversion is
wider than the field width, the field is expanded to contain the conversion result.
The a, e, f, and g conversions will print inf for infinity and nan for both quiet and signaling NaN
values.
The A, E, and G conversions will print INF for infinity and NAN for both quiet and signaling NaN values.
There will be a new F conversion specifier that will be identical to the f conversion specifier except that it
160 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: December 2007 Update