1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
10 .\" References consulted:
11 .\" GNU glibc-2 source code and manual
12 .\" Dinkumware C library reference http://www.dinkumware.com/
13 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
16 .TH WPRINTF 3 2019-03-06 "GNU" "Linux Programmer's Manual"
18 wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf \- formatted
19 wide-character output conversion
25 .BI "int wprintf(const wchar_t *" format ", ...);"
26 .BI "int fwprintf(FILE *" stream ", const wchar_t *" format ", ...);"
27 .BI "int swprintf(wchar_t *" wcs ", size_t " maxlen ,
28 .BI " const wchar_t *" format ", ...);"
30 .BI "int vwprintf(const wchar_t *" format ", va_list " args );
31 .BI "int vfwprintf(FILE *" stream ", const wchar_t *" format ", va_list " args );
32 .BI "int vswprintf(wchar_t *" wcs ", size_t " maxlen ,
33 .BI " const wchar_t *" format ", va_list " args );
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
41 All functions shown above:
49 _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE
50 || _POSIX_C_SOURCE >= 200112L
55 family of functions is
56 the wide-character equivalent of the
59 It performs formatted output of wide
67 perform wide-character output to
70 must not be byte oriented; see
79 perform wide-character output to
82 must not be byte oriented; see
91 perform wide-character output
92 to an array of wide characters.
93 The programmer must ensure that there is
100 These functions are like
108 functions except for the
109 following differences:
114 string is a wide-character string.
117 The output consists of wide characters, not bytes.
135 argument, but these functions do not return \-1 upon
136 buffer overflow on Linux.)
138 The treatment of the conversion characters
147 modifier is present, the
149 argument is converted to a wide character by a call to the
151 function, and the resulting wide character is written.
154 modifier is present, the
156 (wide character) argument is written.
161 modifier is present: the
163 argument is expected to be a pointer to an array of character type
164 (pointer to a string) containing a multibyte character sequence beginning
165 in the initial shift state.
166 Characters from the array are converted to
167 wide characters (each by a call to the
169 function with a conversion state starting in the initial state before
171 The resulting wide characters are written up to
172 (but not including) the terminating null wide character (L\(aq\e0\(aq).
174 specified, no more wide characters than the number specified are written.
175 Note that the precision determines the number of
177 written, not the number of
180 .IR "screen positions" .
181 The array must contain a terminating null byte (\(aq\e0\(aq),
182 unless a precision is given
183 and it is so small that the number of converted wide characters reaches it
184 before the end of the array is reached.
187 modifier is present: the
188 .I "const\ wchar_t\ *"
189 argument is expected to be a pointer to an array of wide characters.
190 Wide characters from the array are written up to (but not including) a
191 terminating null wide character.
192 If a precision is specified, no more than
193 the number specified are written.
194 The array must contain a terminating null
195 wide character, unless a precision is given and it is smaller than or equal
196 to the number of wide characters in the array.
198 The functions return the number of wide characters written, excluding the
199 terminating null wide character in
200 case of the functions
204 They return \-1 when an error occurs.
206 For an explanation of the terms used in this section, see
214 Interface Attribute Value
222 T} Thread safety MT-Safe locale
228 POSIX.1-2001, POSIX.1-2008, C99.
240 string contains non-ASCII wide characters, the program
241 will work correctly only if the
243 category of the current locale at
244 run time is the same as the
246 category of the current locale at
250 representation is platform- and locale-dependent.
251 (The glibc represents
252 wide characters using their Unicode (ISO-10646) code point, but other
253 platforms don't do this.
254 Also, the use of C99 universal character names
255 of the form \eunnnn does not solve this problem.)
257 internationalized programs, the
259 string should consist of ASCII
260 wide characters only, or should be constructed at run time in an
261 internationalized way (e.g., using