##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <cwchar>

From cppreference.com
< cpp‎ | header

This header was originally in the C standard library as `<wchar.h>`.

This header is part of the null-terminated wide and multibyte strings libraries. It also provides some C-style I/O functions and conversion from C-style Date.

### [edit] Macros

NULL | implementation-defined null pointer constant (macro constant) [edit]
WEOF | a non-character value of type wint_t used to indicate errors (macro constant)
WCHAR_MIN | the smallest valid value of wchar_t (macro constant)
WCHAR_MAX | the largest valid value of wchar_t (macro constant)

### [edit] Types

mbstate_t | conversion state information necessary to iterate multibyte character strings (class) [edit]
size_t | unsigned integer type returned by the `sizeof` operator (typedef) [edit]
`wint_t` | integer type that can hold any valid wide character and at least one more value
tm | calendar time type (class) [edit]

### [edit] Functions

##### String manipulation
wcscpy | copies one wide string to another (function) [edit]
wcsncpy | copies a certain amount of wide characters from one string to another (function) [edit]
wcscat | appends a copy of one wide string to another (function) [edit]
wcsncat | appends a certain amount of wide characters from one wide string to another (function) [edit]
wcsxfrm | transform a wide string so that wcscmp would produce the same result as wcscoll (function) [edit]
##### String examination
wcslen | returns the length of a wide string (function) [edit]
wcscmp | compares two wide strings (function) [edit]
wcsncmp | compares a certain amount of characters from two wide strings (function) [edit]
wcscoll | compares two wide strings in accordance to the current locale (function) [edit]
wcschr | finds the first occurrence of a wide character in a wide string (function) [edit]
wcsrchr | finds the last occurrence of a wide character in a wide string (function) [edit]
wcsspn | returns the length of the maximum initial segment that consists of only the wide characters found in another wide string (function) [edit]
wcscspn | returns the length of the maximum initial segment that consists of only the wide not found in another wide string (function) [edit]
wcspbrk | finds the first location of any wide character in one wide string, in another wide string (function) [edit]
wcsstr | finds the first occurrence of a wide string within another wide string (function) [edit]
wcstok | finds the next token in a wide string (function) [edit]
##### Wide character array manipulation
wmemcpy | copies a certain amount of wide characters between two non-overlapping arrays (function) [edit]
wmemmove | copies a certain amount of wide characters between two, possibly overlapping, arrays (function) [edit]
wmemcmp | compares a certain amount of wide characters from two arrays (function) [edit]
wmemchr | finds the first occurrence of a wide character in a wide character array (function) [edit]
wmemset | copies the given wide character to every position in a wide character array (function) [edit]
##### Multibyte/wide character conversion
mbsinit | checks if the mbstate_t object represents initial shift state (function) [edit]
btowc | widens a single-byte narrow character to wide character, if possible (function) [edit]
wctob | narrows a wide character to a single-byte narrow character, if possible (function) [edit]
mbrlen | returns the number of bytes in the next multibyte character, given state (function) [edit]
mbrtowc | converts the next multibyte character to wide character, given state (function) [edit]
wcrtomb | converts a wide character to its multibyte representation, given state (function) [edit]
mbsrtowcs | converts a narrow multibyte character string to wide string, given state (function) [edit]
wcsrtombs | converts a wide string to narrow multibyte character string, given state (function) [edit]
##### Input/Output
fgetwc getwc | gets a wide character from a file stream (function) [edit]
fgetws | gets a wide string from a file stream (function) [edit]
fputwc putwc | writes a wide character to a file stream (function) [edit]
fputws | writes a wide string to a file stream (function) [edit]
getwchar | reads a wide character from stdin (function) [edit]
putwchar | writes a wide character to stdout (function) [edit]
ungetwc | puts a wide character back into a file stream (function) [edit]
fwide | switches a file stream between wide character I/O and narrow character I/O (function) [edit]
wscanf fwscanf swscanf | reads formatted wide character input from stdin, a file stream or a buffer (function) [edit]
vwscanf vfwscanf vswscanf (C++11)(C++11)(C++11) | reads formatted wide character input from stdin, a file stream or a buffer using variable argument list (function) [edit]
wprintf fwprintf swprintf | prints formatted wide character output to stdout, a file stream or a buffer (function) [edit]
vwprintf vfwprintf vswprintf | prints formatted wide character output to stdout, a file stream or a buffer using variable argument list (function) [edit]
##### String conversions
wcsftime | converts a tm object to custom wide string textual representation (function) [edit]
wcstol wcstoll | converts a wide string to an integer value (function) [edit]
wcstoul wcstoull | converts a wide string to an unsigned integer value (function) [edit]
wcstof wcstod wcstold | converts a wide string to a floating point value (function) [edit]

### [edit] Notes

- NULL is also defined in the following headers:
  - `<cstddef>`
  - `<cstring>`
  - `<ctime>`
  - `<clocale>`
  - `<cstdio>`
- std::size_t is also defined in the following headers:
  - `<cstddef>`
  - `<ctime>`
  - `<cstdio>`
- std::wint_t is also defined in the following headers:
  - `<cwctype>`
- std::tm is also defined in the following headers:
  - `<ctime>`

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/cwchar&oldid=65246"