Penguin
Annotated edit history of swprintf(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 WPRINTF
2 !!!WPRINTF
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 CONFORMING TO
8 SEE ALSO
9 NOTES
10 ----
11 !!NAME
12
13
14 wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf - formatted wide character output conversion
15 !!SYNOPSIS
16
17
18 __#include
19 __ ''format''__, ...);
20 int fwprintf (FILE*__ ''stream''__, const wchar_t*__ ''format''__, ...);
21 int swprintf (wchar_t*__ ''wcs''__, size_t__ ''maxlen''__,
22 const wchar_t*__ ''format''__, ...);
23 #include
24 __ ''format''__, va_list__ ''args''__);
25 int vfwprintf (FILE*__ ''stream''__, const wchar_t*__ ''format''__, va_list__ ''args''__);
26 int vswprintf (wchar_t*__ ''wcs''__, size_t__ ''maxlen''__,
27 const wchar_t*__ ''format''__, va_list__ ''args''__);
28 __
29 !!DESCRIPTION
30
31
32 The __wprintf__ family of functions is the wide-character
33 equivalent of the __printf__ family of functions. It
34 performs formatted output of wide characters.
35
36
37 The __wprintf__ and __vwprintf__ functions perform
38 wide character output to __stdout__. __stdout__ must
39 not be byte oriented; see function __fwide__ for more
40 information.
41
42
43 The __fwprintf__ and __vfwprintf__ functions perform
44 wide character output to ''stream''. ''stream'' must
45 not be byte oriented; see function __fwide__ for more
46 information.
47
48
49 The __swprintf__ and __vswprintf__ functions perform
50 wide character output to an array of wide characters. The
51 programmer must ensure that there is room for at least
52 ''maxlen'' wide characters at ''wcs''.
53
54
55 These functions are like the __printf__, __vprintf__,
56 __fprintf__, __vfprintf__, __sprintf__,
57 __vsprintf__ functions except for the following
58 differences:
59
60
61 The ''format'' string is a wide character
62 string.
63
64
65 The output consists of wide characters, not
66 bytes.
67
68
69 __swprintf__ and __vswprintf__ take a ''maxlen''
70 argument, __sprintf__ and __vsprintf__ do not.
71 (__snprintf__ and __vsnprintf__ take a ''maxlen''
72 argument, but these functions do not return -1 upon buffer
73 overflow on Linux.)
74
75
76 The treatment of the conversion characters __c__ and
77 __s__ is different:
78
79
80 __c__
81
82
83 If no __l__ modifier is present, the ''int'' argument
84 is converted to a wide character by a call to the
85 __btowc__ function, and the resulting wide character is
86 written. If an __l__ modifier is present, the
87 ''wint_t'' (wide character) argument is
88 written.
89
90
91 __s__
92
93
94 If no __l__ modifier is present: The ``''const char
95 *'''' argument is expected to be a pointer to an array of
96 character type (pointer to a string) containing a multibyte
97 character sequence beginning in the initial shift state.
98 Characters from the array are converted to wide characters
99 (each by a call to the __mbrtowc__ function with a
100 conversion state starting in the initial state before the
101 first byte). The resulting wide characters are written up to
102 (but not including) the terminating null wide character. If
103 a precision is specified, no more wide characters than the
104 number specified are written. Note that the precision
105 determines the number of ''wide characters'' written, not
106 the number of ''bytes'' or ''screen positions''. The
107 array must contain a terminating null byte, unless a
108 precision is given and it is so small that the number of
109 converted wide characters reaches it before the end of the
110 array is reached. -- If an __l__ modifier is present: The
111 ``''const wchar_t *'''' argument is expected to be a
112 pointer to an array of wide characters. Wide characters from
113 the array are written up to (but not including) a
114 terminating null wide character. If a precision is
115 specified, no more than the number specified are written.
116 The array must contain a terminating null wide character,
117 unless a precision is given and it is smaller than or equal
118 to the number of wide characters in the array.
119 !!RETURN VALUE
120
121
122 The functions return the number of wide characters written,
123 excluding the terminating null wide character in case of the
124 functions __swprintf__ and __vswprintf__. They return
125 -1 when an error occurs.
126 !!CONFORMING TO
127
128
129 ISO/ANSI C, UNIX98
130 !!SEE ALSO
131
132
133 printf(3), fprintf(3), snprintf(3),
134 fputwc(3), fwide(3),
135 wscanf(3)
136 !!NOTES
137
138
139 The behaviour of __wprintf__ et al. depends on the
140 LC_CTYPE category of the current locale.
141
142
143 If the ''format'' string contains non-ASCII wide
144 characters, the program will only work correctly if the
145 LC_CTYPE category of the current locale at run time is the
146 same as the LC_CTYPE category of the current locale at
147 compile time. This is because the __wchar_t__
148 representation is platform and locale dependent. (The GNU
149 libc represents wide characters using their Unicode
150 (ISO-10646) code point, but other platforms don't do this.
151 Also, the use of ISO C99 universal character names of the
152 form unnnn does not solve this problem.) Therefore, in
153 internationalized programs, the ''format'' string should
154 consist of ASCII wide characters only, or should be
155 constructed at run time in an internationalized way (e.g.
156 using __gettext__ or __iconv__, followed by
157 __mbstowcs__).
158 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.