HP-UX Reference (11i v1 05/09) - 3 Library Functions N-Z (vol 7)
p
printf(3S) printf(3S)
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
e, f, and g conversions will print inf for infinity and nan for both quiet and signaling NaN values.
The 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
will print infinity and NaN as respectively, INF and NAN.
Characters generated by printf() and fprintf() are printed as if putc() had been called (see
putc(3S)).
APPLICATION USAGE
To use _INCLUDE__STDC_A1_SOURCE functionality, the
_INCLUDE__STDC_A1_SOURCE flag must
be passed as a compiler option or defined as a macro in source files.
After
printf() or fprintf() is applied to a stream, the stream becomes byte-oriented (see orienta-
tion(5)).
Section 3−−664 Hewlett-Packard Company − 3 − HP-UX 11i Version 1: September 2005