1<wchar.h>(P) POSIX Programmer's Manual <wchar.h>(P)
2
3
4
6 wchar.h - wide-character handling
7
9 #include <wchar.h>
10
12 Some of the functionality described on this reference page extends the
13 ISO C standard. Applications shall define the appropriate feature test
14 macro (see the System Interfaces volume of IEEE Std 1003.1-2001, Sec‐
15 tion 2.2, The Compilation Environment) to enable the visibility of
16 these symbols in this header.
17
18 The <wchar.h> header shall define the following types:
19
20 wchar_t
21 As described in <stddef.h> .
22
23 wint_t An integer type capable of storing any valid value of wchar_t or
24 WEOF.
25
26 wctype_t
27 A scalar type of a data object that can hold values which repre‐
28 sent locale-specific character classification.
29
30 mbstate_t
31 An object type other than an array type that can hold the con‐
32 version state information necessary to convert between sequences
33 of (possibly multi-byte) characters and wide characters. If a
34 codeset is being used such that an mbstate_t needs to preserve
35 more than 2 levels of reserved state, the results are unspeci‐
36 fied.
37
38 FILE As described in <stdio.h> .
39
40 size_t As described in <stddef.h> .
41
42 va_list
43 As described in <stdarg.h> .
44
45
46 The implementation shall support one or more programming environments
47 in which the width of wint_t is no greater than the width of type long.
48 The names of these programming environments can be obtained using the
49 confstr() function or the getconf utility.
50
51 The following shall be declared as functions and may also be defined as
52 macros. Function prototypes shall be provided.
53
54
55 wint_t btowc(int);
56 wint_t fgetwc(FILE *);
57 wchar_t *fgetws(wchar_t *restrict, int, FILE *restrict);
58 wint_t fputwc(wchar_t, FILE *);
59 int fputws(const wchar_t *restrict, FILE *restrict);
60 int fwide(FILE *, int);
61 int fwprintf(FILE *restrict, const wchar_t *restrict, ...);
62 int fwscanf(FILE *restrict, const wchar_t *restrict, ...);
63 wint_t getwc(FILE *);
64 wint_t getwchar(void);
65
66 int iswalnum(wint_t);
67 int iswalpha(wint_t);
68 int iswcntrl(wint_t);
69 int iswctype(wint_t, wctype_t);
70 int iswdigit(wint_t);
71 int iswgraph(wint_t);
72 int iswlower(wint_t);
73 int iswprint(wint_t);
74 int iswpunct(wint_t);
75 int iswspace(wint_t);
76 int iswupper(wint_t);
77 int iswxdigit(wint_t);
78
79 size_t mbrlen(const char *restrict, size_t, mbstate_t *restrict);
80 size_t mbrtowc(wchar_t *restrict, const char *restrict, size_t,
81 mbstate_t *restrict);
82 int mbsinit(const mbstate_t *);
83 size_t mbsrtowcs(wchar_t *restrict, const char **restrict, size_t,
84 mbstate_t *restrict);
85 wint_t putwc(wchar_t, FILE *);
86 wint_t putwchar(wchar_t);
87 int swprintf(wchar_t *restrict, size_t,
88 const wchar_t *restrict, ...);
89 int swscanf(const wchar_t *restrict,
90 const wchar_t *restrict, ...);
91
92 wint_t towlower(wint_t);
93 wint_t towupper(wint_t);
94
95 wint_t ungetwc(wint_t, FILE *);
96 int vfwprintf(FILE *restrict, const wchar_t *restrict, va_list);
97 int vfwscanf(FILE *restrict, const wchar_t *restrict, va_list);
98 int vwprintf(const wchar_t *restrict, va_list);
99 int vswprintf(wchar_t *restrict, size_t,
100 const wchar_t *restrict, va_list);
101 int vswscanf(const wchar_t *restrict, const wchar_t *restrict,
102 va_list);
103 int vwscanf(const wchar_t *restrict, va_list);
104 size_t wcrtomb(char *restrict, wchar_t, mbstate_t *restrict);
105 wchar_t *wcscat(wchar_t *restrict, const wchar_t *restrict);
106 wchar_t *wcschr(const wchar_t *, wchar_t);
107 int wcscmp(const wchar_t *, const wchar_t *);
108 int wcscoll(const wchar_t *, const wchar_t *);
109 wchar_t *wcscpy(wchar_t *restrict, const wchar_t *restrict);
110 size_t wcscspn(const wchar_t *, const wchar_t *);
111 size_t wcsftime(wchar_t *restrict, size_t,
112 const wchar_t *restrict, const struct tm *restrict);
113 size_t wcslen(const wchar_t *);
114 wchar_t *wcsncat(wchar_t *restrict, const wchar_t *restrict, size_t);
115 int wcsncmp(const wchar_t *, const wchar_t *, size_t);
116 wchar_t *wcsncpy(wchar_t *restrict, const wchar_t *restrict, size_t);
117 wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
118 wchar_t *wcsrchr(const wchar_t *, wchar_t);
119 size_t wcsrtombs(char *restrict, const wchar_t **restrict,
120 size_t, mbstate_t *restrict);
121 size_t wcsspn(const wchar_t *, const wchar_t *);
122 wchar_t *wcsstr(const wchar_t *restrict, const wchar_t *restrict);
123 double wcstod(const wchar_t *restrict, wchar_t **restrict);
124 float wcstof(const wchar_t *restrict, wchar_t **restrict);
125 wchar_t *wcstok(wchar_t *restrict, const wchar_t *restrict,
126 wchar_t **restrict);
127 long wcstol(const wchar_t *restrict, wchar_t **restrict, int);
128 long double wcstold(const wchar_t *restrict, wchar_t **restrict);
129 long long wcstoll(const wchar_t *restrict, wchar_t **restrict, int);
130 unsigned long wcstoul(const wchar_t *restrict, wchar_t **restrict, int);
131 unsigned long long
132 wcstoull(const wchar_t *restrict, wchar_t **restrict, int);
133
134 wchar_t *wcswcs(const wchar_t *, const wchar_t *);
135 int wcswidth(const wchar_t *, size_t);
136
137 size_t wcsxfrm(wchar_t *restrict, const wchar_t *restrict, size_t);
138 int wctob(wint_t);
139
140 wctype_t wctype(const char *);
141 int wcwidth(wchar_t);
142
143 wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
144 int wmemcmp(const wchar_t *, const wchar_t *, size_t);
145 wchar_t *wmemcpy(wchar_t *restrict, const wchar_t *restrict, size_t);
146 wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
147 wchar_t *wmemset(wchar_t *, wchar_t, size_t);
148 int wprintf(const wchar_t *restrict, ...);
149 int wscanf(const wchar_t *restrict, ...);
150
151 The <wchar.h> header shall define the following macros:
152
153 WCHAR_MAX
154 The maximum value representable by an object of type wchar_t.
155
156 WCHAR_MIN
157 The minimum value representable by an object of type wchar_t.
158
159 WEOF Constant expression of type wint_t that is returned by several
160 WP functions to indicate end-of-file.
161
162 NULL As described in <stddef.h> .
163
164
165 The tag tm shall be declared as naming an incomplete structure type,
166 the contents of which are described in the header <time.h> .
167
168 Inclusion of the <wchar.h> header may make visible all symbols from the
169 headers <ctype.h>, <string.h>, <stdarg.h>, <stddef.h>, <stdio.h>,
170 <stdlib.h>, and <time.h>.
171
172 The following sections are informative.
173
175 The iswblank() function was a late addition to the ISO C standard and
176 was introduced at the same time as the ISO C standard introduced
177 <wctype.h>, which contains all of the isw*() functions. The Open Group
178 Base Specifications had previously aligned with the MSE working draft
179 and had introduced the rest of the isw*() functions into <wchar.h>. For
180 backwards-compatibility, the original set of isw*() functions, without
181 iswblank(), are permitted (as an XSI extension) in <wchar.h>. For maxi‐
182 mum portability, applications should include <wctype.h> in order to
183 obtain declarations for the isw*() functions.
184
186 In the ISO C standard, the symbols referenced as XSI extensions are in
187 <wctype.h>. Their presence here is thus an extension.
188
190 None.
191
193 <ctype.h> , <stdarg.h> , <stddef.h> , <stdio.h> , <stdlib.h> ,
194 <string.h> , <time.h> , <wctype.h> , the System Interfaces volume of
195 IEEE Std 1003.1-2001, btowc(), confstr(), fgetwc(), fgetws(), fputwc(),
196 fputws(), fwide(), fwprintf(), fwscanf(), getwc(), getwchar(), iswal‐
197 num(), iswalpha(), iswcntrl(), iswctype(), iswdigit(), iswgraph(),
198 iswlower(), iswprint(), iswpunct(), iswspace(), iswupper(),
199 iswxdigit(), iswctype(), mbsinit(), mbrlen(), mbrtowc(), mbsrtowcs(),
200 putwc(), putwchar(), swprintf(), swscanf(), towlower(), towupper(),
201 ungetwc(), vfwprintf(), vfwscanf(), vswprintf(), vswscanf(), vwscanf(),
202 wcrtomb(), wcsrtombs(), wcscat(), wcschr(), wcscmp(), wcscoll(),
203 wcscpy(), wcscspn(), wcsftime(), wcslen(), wcsncat(), wcsncmp(),
204 wcsncpy(), wcspbrk(), wcsrchr(), wcsspn(), wcsstr(), wcstod(),
205 wcstof(), wcstok(), wcstol(), wcstold(), wcstoll(), wcstoul(),
206 wcstoull(), wcswcs(), wcswidth(), wcsxfrm(), wctob(), wctype(),
207 wcwidth(), wmemchr(), wmemcmp(), wmemcpy(), wmemmove(), wmemset(),
208 wprintf(), wscanf(), the Shell and Utilities volume of
209 IEEE Std 1003.1-2001, getconf
210
212 Portions of this text are reprinted and reproduced in electronic form
213 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
214 -- Portable Operating System Interface (POSIX), The Open Group Base
215 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
216 Electrical and Electronics Engineers, Inc and The Open Group. In the
217 event of any discrepancy between this version and the original IEEE and
218 The Open Group Standard, the original IEEE and The Open Group Standard
219 is the referee document. The original Standard can be obtained online
220 at http://www.opengroup.org/unix/online.html .
221
222
223
224IEEE/The Open Group 2003 <wchar.h>(P)