fwprintf.3c (2010 09)
f
fwprintf(3C) fwprintf(3C)
NAME
fwprintf(), wprintf(), swprintf() - print formatted wide-character output
SYNOPSIS
#include <stdio.h>
#include <wchar.h>
int fwprintf(
FILE *__restrict stream ,
const wchar_t *__restrict format ,
...);
int wprintf(
const wchar_t *__restrict format ,
...);
int swprintf(
wchar_t *__restrict s,
size_t n,
const wchar_t *__restrict 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. Zero or more of the following optional character specifications:
• an optional
h specifying that a following n conversion wide-character applies to a pointer
to a type short int argument
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1