HP-UX Reference (11i v2 03/08) - 3 Library Functions A-M (vol 6)

f
fwprintf(3C) fwprintf(3C)
NAME
fwprintf( ), wprintf( ), swprintf( ) - print formatted wide-character output
SYNOPSIS
#include <stdio.h>
#include <wchar.h>
int fwprintf(FILE *stream, const wchar_t *format, ... );
int wprintf(const wchar_t *format, ... );
int swprintf(wchar_t *s, size_t n, const wchar_t *format, ... );
DESCRIPTION
The fwprintf function places output on the named output stream .
The
wprintf() function places output on the standard output stream stdout .
The
swprintf() function places output followed by the null wide-character in consecutive wide-
characters starting at *s; no more than n wide-characters are written, including a terminating null wide-
character, which is always added (unless n is zero).
Each of these functions converts, formats and prints its arguments under control of the format wide-
character string. The format is composed of zero or more directives: ordinary wide-characters, which are
simply copied to the output stream and conversion specifications, each of which results in the fetching of
zero or more arguments.
Conversions can be applied to the nth argument after the format in the argument list, rather than to the
next unused argument. In this case, the conversion wide-character
% (see below) is replaced by the
sequence
%n$, where n is a decimal integer in the range 1 through {NL_ARGMAX}
, giving the position of
the argument in the argument list. This feature provides for the definition of format wide-character
strings that select arguments in an order appropriate to specific languages (see the EXAMPLES section).
In format wide-character strings containing the
%n$ form of conversion specifications, numbered argu-
ments in the argument list can be referenced from the format wide-character string as many times as
required.
In format wide-character strings containing the
% form of conversion specifications, each argument in the
argument list is used exactly once.
All forms of the
fwprintf() functions allow for the insertion of a language-dependent radix character
in the output string, output as a wide-character value. The radix character is defined in the program’s
locale (category LC_NUMERIC).
In the POSIX locale, or in a locale where the radix character is not defined, the radix character defaults
to a period (.).
Each conversion specification is introduced by the
% wide-character or by the wide-character sequence
%n$, after which the following appear in sequence:
1. Zero or more flags (in any order), which modify the meaning of the conversion specification.
2. An optional minimum field width. If the converted value has fewer wide-characters than the
field width, it will be padded with spaces by default on the left.
3. An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x
and X conversions.
4. An optional
l (ell) specifying that a following c conversion wide-character applies to a wint_t
argument; an optional l specifying that a following s conversion wide-character applies to a
wchar_t argument; an optional h specifying that a following d, i, o, u, x or X conversion
wide-character applies to a type short int or type unsigned short int argument (the argument
will have been promoted according to the integral promotions, and its value will be converted
to type short int or unsigned short int before printing); an optional hL specifying that a follow-
ing e, f,org conversion wide-character applies to a type extended which is the 80-bit
IEEE-754 double-extended type in the Itanium architecture; an optional h specifying that a
following n conversion wide-character applies to a pointer to a type short int argument;
5. A conversion wide-character that indicates the type of conversion to be applied.
A field width, or precision, or both, may be indicated by an asterisk (*). In this case an argument of type
int supplies the field width or precision . Arguments specifying field width,orprecision, or both must
Section 3330 Hewlett-Packard Company 1 HP-UX 11i Version 2: August 2003