C++ Standard Library C++ STL Library

C++ - <cwchar> (wchar.h)



The C++ has a number of functions and macros that are available to work with C wide strings. These functions are available to use in a current program after including the header file using - #include <cwchar> or #include <wchar.h>. All functions and macros of this header file are listed below:

Library Functions

Input/Output Functions

FunctionsDescription
fgetwc() Gets wide character from stream.
fgetws() Gets wide string from stream.
fputwc() Writes wide character to stream.
fputws() Writes wide string to stream.
fwide() Switches a file stream between wide character I/O and narrow character I/O.
fwprintf() Writes formatted data to stream.
fwscanf() Reads formatted data from stream.
getwc() Gets wide character from stream.
getwchar() Gets wide character from stdin.
putwc() Writes wide character to stream.
putwchar() Writes wide character to stdout.
swprintf() Writes formatted data to a wide string.
swscanf() Reads formatted data from string.
ungetwc() Puts a wide character back into the stream.
vfwprintf() Writes formatted data from variable argument list to stream
vfwscanf() (C++11) Reads formatted data from stream into variable argument list
vswprintf() (C++11) Writes formatted data from variable argument list to sized buffer
vswscanf() (C++11) Reads formatted data from wide string into variable argument list
vwprintf() Prints formatted data from variable argument list to stdout
vwscanf() (C++11) Reads formatted data into variable argument list
wprintf() Prints formatted data to stdout.
wscanf() Reads formatted data from stdin.

General utilities Functions

FunctionsDescription
wcstod() Converts wide string to double.
wcstof() (C++11) Converts wide string to float.
wcstol() Converts wide string to long integer.
wcstold() (C++11) Converts wide string to long double.
wcstoll() (C++11) Converts wide string to long long integer.
wcstoul() Converts wide string to unsigned long integer.
wcstoull() (C++11) Converts wide string to unsigned long long integer.

Character/string conversion Functions

FunctionsDescription
btowc() Converts single byte character to wide character.
mbrlen() Gets length of multibyte character.
mbrtowc() Convert multibyte sequence to wide character.
mbsinit() Check if initial conversion state.
wcrtomb() Converts wide character to multibyte sequence.
wctob() Converts wide character to single byte.

String Functions

FunctionsDescription
wcscat() Concatenate wide strings.
wcschr() Searches the first occurrence of a wide character in a wide string.
wcscmp() Compares two wide strings.
wcscoll() Compares two wide strings using locale.
wcscpy() Copy wide string.
wcscspn() Get span until character in wide string.
wcslen() Returns the length of a wide string.
wmemcmp() Compares two blocks of wide characters.
wcsncat() Append characters from wide string.
wcsncmp() Compare characters of two wide strings.
wcsncpy() Copy characters from wide string.
wcspbrk() Searches the first occurrence of any wide character of a wide string inside another wide string.
wcsrchr() Searches the last occurrence of a wide character in a wide string.
wcsspn() Get span of wide character set in wide string.
wcsstr() Searches the first occurrence of a wide string inside another wide string.
wcstok() Split a wide string into tokens.
wcsxfrm() Transform wide string using locale.
wmemchr() Locate wide character in block of wide characters.
wmemcpy() Copy block of wide characters.
wmemmove() Move block of wide characters.
wmemset() Fill array of wide characters.

Time Functions

FunctionsDescription
wcsftime() Formats time as wide string.

Library Types

TypesDescription
mbstate_t Multibyte conversion state.
size_t Unsigned integer type.
tm Time structure.
wchar_t Wide character type.
wint_t Wide character integer type.

Library Macros

Macro constants

MacrosDescription
NULL Null pointer.
WCHAR_MAX Maximum value of wchar_t.
WCHAR_MIN Minimum value of wchar_t.
WEOF Wide End-of-File.