From cppreference.com
This header was originally in the C standard library as
.
This header is part of the null-terminated
and
strings libraries. It also provides some
functions and conversion from
.
Macros
implementation-defined null pointer constant
(macro constant)
WEOF
a non-character value of type std::wint_t used to indicate errors
(macro constant)WCHAR_WIDTH
(C++26)
bit width of wchar_t
(macro constant)
WCHAR_MIN
minimum value of wchar_t
(macro constant)
WCHAR_MAX
maximum value of wchar_t
(macro constant)
Types
conversion state information necessary to iterate multibyte character strings
(class)
unsigned integer type returned by the
operator
(typedef)
wint_tinteger type that can hold any valid wide character and at least one more value calendar time type
(class)
Functions
String manipulation
copies one wide string to another
(function)
copies a certain amount of wide characters from one string to another
(function)
appends a copy of one wide string to another
(function)
appends a certain amount of wide characters from one wide string to another
(function)
transform a wide string so that wcscmp would produce the same result as wcscoll
(function)
String examination
returns the length of a wide string
(function)
compares two wide strings
(function)
compares a certain amount of characters from two wide strings
(function)
compares two wide strings in accordance to the current locale
(function)
finds the first occurrence of a wide character in a wide string
(function)
finds the last occurrence of a wide character in a wide string
(function)
returns the length of the maximum initial segment that consists
of only the wide characters found in another wide string
(function)
returns the length of the maximum initial segment that consists
of only the wide not found in another wide string
(function)
finds the first location of any wide character in one wide string, in another wide string
(function)
finds the first occurrence of a wide string within another wide string
(function)
finds the next token in a wide string
(function)
Wide character array manipulation
copies a certain amount of wide characters between two non-overlapping arrays
(function)
copies a certain amount of wide characters between two, possibly overlapping, arrays
(function)
compares a certain amount of wide characters from two arrays
(function)
finds the first occurrence of a wide character in a wide character array
(function)
copies the given wide character to every position in a wide character array
(function)
Multibyte/wide character conversion
checks if the
object represents initial shift state
(function)
widens a single-byte narrow character to wide character, if possible
(function)
narrows a wide character to a single-byte narrow character, if possible
(function)
returns the number of bytes in the next multibyte character, given state
(function)
converts the next multibyte character to wide character, given state
(function)
converts a wide character to its multibyte representation, given state
(function)
converts a narrow multibyte character string to wide string, given state
(function)
converts a wide string to narrow multibyte character string, given state
(function)
Input/Output
gets a wide character from a file stream
(function)
gets a wide string from a file stream
(function)
writes a wide character to a file stream
(function)
writes a wide string to a file stream
(function)
reads a wide character from
(function)
writes a wide character to
(function)
puts a wide character back into a file stream
(function)
switches a file stream between wide character I/O and narrow character I/O
(function)
reads formatted wide character input from
, a file stream or a buffer
(function)
(C++11)(C++11)(C++11)
reads formatted wide character input from
, a file stream
or a buffer using variable argument list
(function)
prints formatted wide character output to
, a file stream or a buffer
(function)
prints formatted wide character output to
, a file stream
or a buffer using variable argument list
(function)
String conversions
converts a
object to custom wide string textual representation
(function)
converts a wide string to an integer value
(function)
converts a wide string to an unsigned integer value
(function)
converts a wide string to a floating-point value
(function)
Notes
is also defined in the following headers:
is also defined in the following headers:
std::wint_t is also defined in the following headers:
is also defined in the following headers:
Synopsis
#define __STDC_VERSION_WCHAR_H__ 202311Lnamespacestd{usingsize_t=/* implementation-defined */;// freestandingusingmbstate_t=/* see description */;// freestandingusingwint_t=/* see description */;// freestandingstructtm;intfwprintf(FILE*stream,constwchar_t*format,...);intfwscanf(FILE*stream,constwchar_t*format,...);intswprintf(wchar_t*s,size_tn,constwchar_t*format,...);intswscanf(constwchar_t*s,constwchar_t*format,...);intvfwprintf(FILE*stream,constwchar_t*format,va_listarg);intvfwscanf(FILE*stream,constwchar_t*format,va_listarg);intvswprintf(wchar_t*s,size_tn,constwchar_t*format,va_listarg);intvswscanf(constwchar_t*s,constwchar_t*format,va_listarg);intvwprintf(constwchar_t*format,va_listarg);intvwscanf(constwchar_t*format,va_listarg);intwprintf(constwchar_t*format,...);intwscanf(constwchar_t*format,...);wint_tfgetwc(FILE*stream);wchar_t*fgetws(wchar_t*s,intn,FILE*stream);wint_tfputwc(wchar_tc,FILE*stream);intfputws(constwchar_t*s,FILE*stream);intfwide(FILE*stream,intmode);wint_tgetwc(FILE*stream);wint_tgetwchar();wint_tputwc(wchar_tc,FILE*stream);wint_tputwchar(wchar_tc);wint_tungetwc(wint_tc,FILE*stream);doublewcstod(constwchar_t*nptr,wchar_t**endptr);floatwcstof(constwchar_t*nptr,wchar_t**endptr);longdoublewcstold(constwchar_t*nptr,wchar_t**endptr);longintwcstol(constwchar_t*nptr,wchar_t**endptr,intbase);longlongintwcstoll(constwchar_t*nptr,wchar_t**endptr,intbase);unsignedlongintwcstoul(constwchar_t*nptr,wchar_t**endptr,intbase);unsignedlonglongintwcstoull(constwchar_t*nptr,wchar_t**endptr,intbase);wchar_t*wcscpy(wchar_t*s1,constwchar_t*s2);// freestandingwchar_t*wcsncpy(wchar_t*s1,constwchar_t*s2,size_tn);// freestandingwchar_t*wmemcpy(wchar_t*s1,constwchar_t*s2,size_tn);// freestandingwchar_t*wmemmove(wchar_t*s1,constwchar_t*s2,size_tn);// freestandingwchar_t*wcscat(wchar_t*s1,constwchar_t*s2);// freestandingwchar_t*wcsncat(wchar_t*s1,constwchar_t*s2,size_tn);// freestandingintwcscmp(constwchar_t*s1,constwchar_t*s2);// freestandingintwcscoll(constwchar_t*s1,constwchar_t*s2);intwcsncmp(constwchar_t*s1,constwchar_t*s2,size_tn);// freestandingsize_twcsxfrm(wchar_t*s1,constwchar_t*s2,size_tn);intwmemcmp(constwchar_t*s1,constwchar_t*s2,size_tn);// freestandingconstwchar_t*wcschr(constwchar_t*s,wchar_tc);// freestandingwchar_t*wcschr(wchar_t*s,wchar_tc);// freestandingsize_twcscspn(constwchar_t*s1,constwchar_t*s2);// freestandingconstwchar_t*wcspbrk(constwchar_t*s1,constwchar_t*s2);// freestandingwchar_t*wcspbrk(wchar_t*s1,constwchar_t*s2);// freestandingconstwchar_t*wcsrchr(constwchar_t*s,wchar_tc);// freestandingwchar_t*wcsrchr(wchar_t*s,wchar_tc);// freestandingsize_twcsspn(constwchar_t*s1,constwchar_t*s2);// freestandingconstwchar_t*wcsstr(constwchar_t*s1,constwchar_t*s2);// freestandingwchar_t*wcsstr(wchar_t*s1,constwchar_t*s2);// freestandingwchar_t*wcstok(wchar_t*s1,constwchar_t*s2,wchar_t**ptr);// freestandingconstwchar_t*wmemchr(constwchar_t*s,wchar_tc,size_tn);// freestandingwchar_t*wmemchr(wchar_t*s,wchar_tc,size_tn);// freestandingsize_twcslen(constwchar_t*s);// freestandingwchar_t*wmemset(wchar_t*s,wchar_tc,size_tn);// freestandingsize_twcsftime(wchar_t*s,size_tmaxsize,constwchar_t*format,consttm*timeptr);wint_tbtowc(intc);intwctob(wint_tc);// multibyte / wide string and character conversion functionsintmbsinit(constmbstate_t*ps);size_tmbrlen(constchar*s,size_tn,mbstate_t*ps);size_tmbrtowc(wchar_t*pwc,constchar*s,size_tn,mbstate_t*ps);size_twcrtomb(char*s,wchar_twc,mbstate_t*ps);size_tmbsrtowcs(wchar_t*dst,constchar**src,size_tlen,mbstate_t*ps);size_twcsrtombs(char*dst,constwchar_t**src,size_tlen,mbstate_t*ps);}#define NULL /* implementation-defined */// freestanding#define WCHAR_MAX /* see description */// freestanding#define WCHAR_MIN /* see description */// freestanding#define WEOF /* see description */// freestanding#define WCHAR_WIDTH /* see description */// freestandingDefect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior
C++98
was not provided in <cwchar>provided