1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\" Dinkumware C library reference http://www.dinkumware.com/
11 .\" OpenGroup's Single Unix specification http://www.UNIX-systems.org/online.html
14 .TH WPRINTF 3 1999-11-20 "GNU" "Linux Programmer's Manual"
16 wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf \- formatted
17 wide-character output conversion
23 .BI "int wprintf(const wchar_t *" format ", ...);"
24 .BI "int fwprintf(FILE *" stream ", const wchar_t *" format ", ...);"
25 .BI "int swprintf(wchar_t *" wcs ", size_t " maxlen ,
26 .BI " const wchar_t *" format ", ...);"
28 .B #include <stdarg.h>
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 );
38 family of functions is
39 the wide-character equivalent of the
42 It performs formatted output of wide
50 perform wide-character output to \fBstdout\fP.
51 \fBstdout\fP must not be byte oriented; see function
60 perform wide-character output to \fIstream\fP.
61 \fIstream\fP must not be byte oriented; see function
70 perform wide-character output
71 to an array of wide characters.
72 The programmer must ensure that there is
73 room for at least \fImaxlen\fP wide
74 characters at \fIwcs\fP.
76 These functions are like
84 functions except for the
85 following differences:
88 The \fIformat\fP string is a wide-character string.
91 The output consists of wide characters, not bytes.
97 take a \fImaxlen\fP argument,
105 take a \fImaxlen\fP argument, but these functions do not return \-1 upon
106 buffer overflow on Linux.)
108 The treatment of the conversion characters \fBc\fP and \fBs\fP is different:
113 modifier is present, the
115 argument is converted to a wide character by a call to the
117 function, and the resulting wide character is written.
120 modifier is present, the
122 (wide character) argument is written.
127 modifier is present: The
128 .IR "" `` "const char *" ''
129 argument is expected to be a pointer to an array of character type
130 (pointer to a string) containing a multibyte character sequence beginning
131 in the initial shift state.
132 Characters from the array are converted to
133 wide characters (each by a call to the
135 function with a conversion state starting in the initial state before
137 The resulting wide characters are written up to
138 (but not including) the terminating null wide character.
140 specified, no more wide characters than the number specified are written.
141 Note that the precision determines the number of
143 written, not the number of
146 .IR "screen positions" .
147 The array must contain a terminating null byte, unless a precision is given
148 and it is so small that the number of converted wide characters reaches it
149 before the end of the array is reached.
152 modifier is present: The
153 .IR "" `` "const wchar_t *" ''
154 argument is expected to be a pointer to an array of wide characters.
155 Wide characters from the array are written up to (but not including) a
156 terminating null wide character.
157 If a precision is specified, no more than
158 the number specified are written.
159 The array must contain a terminating null
160 wide character, unless a precision is given and it is smaller than or equal
161 to the number of wide characters in the array.
163 The functions return the number of wide characters written, excluding the
164 terminating null wide character in
165 case of the functions
169 They return \-1 when an error occurs.
176 on the LC_CTYPE category of the
179 If the \fIformat\fP string contains non-ASCII wide characters, the program
180 will only work correctly if the LC_CTYPE category of the current locale at
181 run time is the same as the LC_CTYPE category of the current locale at
185 representation is platform and locale dependent.
186 (The GNU libc represents
187 wide characters using their Unicode (ISO-10646) code point, but other
188 platforms don't do this.
189 Also, the use of C99 universal character names
190 of the form \\unnnn does not solve this problem.)
192 internationalized programs, the \fIformat\fP string should consist of ASCII
193 wide characters only, or should be constructed at run time in an
194 internationalized way (e.g. using