C Standard Library

C - <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 <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.
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.
wprintf() Prints formatted data to stdout.

Character/string conversion Functions

FunctionsDescription
btowc() Converts single byte character to wide 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.

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.

5