WPRINTF(3) Linux Programmer's Manual WPRINTF(3)
NAME
wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf - formatted wide-character output conversion
SYNOPSIS
#include <stdio.h>
#include <wchar.h>
int wprintf(const wchar_t *format, ...);
int fwprintf(FILE *stream, const wchar_t *format, ...);
int swprintf(wchar_t *wcs, size_t maxlen,
const wchar_t *format, ...);
int vwprintf(const wchar_t *format, va_list args);
int vfwprintf(FILE *stream, const wchar_t *format, va_list args);
int vswprintf(wchar_t *wcs, size_t maxlen,
const wchar_t *format, va_list args);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
All functions shown above:
_XOPEN_SOURCE >= 500 || _ISOC99_SOURCE ||
_POSIX_C_SOURCE >= 200112L
DESCRIPTION
The wprintf() family of functions is the wide-character equivalent of the printf(3) family of functions. It performs formatted output of
wide characters.
The wprintf() and vwprintf() functions perform wide-character output to stdout. stdout must not be byte oriented; see fwide(3) for more
information.
The fwprintf() and vfwprintf() functions perform wide-character output to stream. stream must not be byte oriented; see fwide(3) for more
information.
The swprintf() and vswprintf() functions perform wide-character output to an array of wide characters. The programmer must ensure that
there is room for at least maxlen wide characters at wcs.
These functions are like the printf(3), vprintf(3), fprintf(3), vfprintf(3), sprintf(3), vsprintf(3) functions except for the following
differences:
o The format string is a wide-character string.
o The output consists of wide characters, not bytes.
o swprintf() and vswprintf() take a maxlen argument, sprintf(3) and vsprintf(3) do not. (snprintf(3) and vsnprintf(3) take a maxlen
argument, but these functions do not return -1 upon buffer overflow on Linux.)
The treatment of the conversion characters c and s is different:
c If no l modifier is present, the int argument is converted to a wide character by a call to the btowc(3) function, and the resulting
wide character is written. If an l modifier is present, the wint_t (wide character) argument is written.
s If no l modifier is present: the const char * argument is expected to be a pointer to an array of character type (pointer to a
string) containing a multibyte character sequence beginning in the initial shift state. Characters from the array are converted to
wide characters (each by a call to the mbrtowc(3) function with a conversion state starting in the initial state before the first
byte). The resulting wide characters are written up to (but not including) the terminating null wide character (L'