wchar.h

Overview

Related Modules:

UTILS

Description:

Declares commonly used functions related to wide characters.

You can use functions provided in this file to perform operations such as reading, writing, comparing, concatenating, copying, and searching wide characters.

Since:

1.0

Version:

1.0

Summary

Functions

Function Name

Description

wcscpy (wchar_t dest, const wchar_t src)

wchar_t  

Copies the wide characters pointed to by src to the wide character array pointed to by dest, including the terminating null character ‘\0’. .

wcsncpy (wchar_t dest, const wchar_t src, size_t n)

wchar_t  

Copies the first n wide characters pointed to by src to the wide character array pointed to by dest.

wcscat (wchar_t dest, const wchar_t src)

wchar_t  

Appends a copy of the wide characters pointed to by src to the end of the wide character array pointed to by dest and adds a terminating null character ‘\0’.

wcsncat (wchar_t dest, const wchar_t src, size_t n)

wchar_t  

Appends a copy of the first n wide characters pointed to by src to the end of the wide characters pointed to by dest and adds a terminating null character ‘\0’.

wcscmp (const wchar_t s1, const wchar_t s2)

int 

Compares each character in the string pointed to by s1 with that in the string pointed to by s2 in ASCII-code order.

wcsncmp (const wchar_t s1, const wchar_t s2, size_t n)

int 

Compares the first n characters in the string pointed to by s1 with those in the string pointed to by s2 in ASCII-code order.

wcscoll (const wchar_t ws1, const wchar_t ws2)

int 

Compares the wide characters in the string pointed to by ws1 with those in the string pointed to by ws2 based on the specified locale LC_COLLATE.

wcsxfrm (wchar_t s1, const wchar_t s2, size_t n)

size_t 

Compares the first n wide characters in the string pointed to by s1 with those in the string pointed to by s2.

wcschr (const wchar_t wcs, wchar_t wc)

wchar_t  

Locates the first occurrence of the wide character pointed to by wc in the wide character string pointed to by wcs.

wcsrchr (const wchar_t wcs, wchar_t wc)

wchar_t  

Locates the last occurrence of the wide character pointed to by wc in the wide character string pointed to by wcs.

wcscspn (const wchar_t wcs, const wchar_t accept)

size_t 

Scans the wide character string pointed to by wcs for any wide characters specified in reject and obtains the number of unmatched characters in wcs.

wcsspn (const wchar_t wcs, const wchar_t accept)

size_t 

Scans the wide character string pointed to by wcs for any wide characters specified in reject and obtains the number matched characters in wcs.

wcspbrk (const wchar_t wcs, const wchar_t accept)

wchar_t  

Scans the wide character string pointed to by wcs for any wide characters specified in accept and obtains the first occurrence of the matched character.

wcstok (wchar_t wcs, const wchar_t delim, wchar_t **ptr)

wchar_t  

Splits a wide character string pointed to by wcs into tokens using the given delimiter.

wcslen (const wchar_t s)

size_t 

Calculates the length of a wide character string pointed to by s.

wcswcs (const wchar_t haystack, const wchar_t needle)

wchar_t  

Searches the wide character string pointed to by dest for the first occurrence of the wide character string pointed to by src.

wmemchr (const wchar_t s, wchar_t c, size_t n)

wchar_t  

Searches for the first position of the matched wide character within the specified number of characters in a wide character string.

wmemcmp (const wchar_t lhs, const wchar_t rhs, size_t count)

int 

Compares the first count characters in the string pointed to by lhs with the first count characters in the string pointed to by rhs.

wmemcpy (wchar_t dest, const wchar_t src, size_t count)

wchar_t  

Copies count successive characters from the wide character array pointed to by src to the wide character array pointed to by dest.

wmemmove (wchar_t dest, const wchar_t src, size_t count)

wchar_t  

Copies count successive characters from the wide character array pointed to by src to the wide character array pointed to by dest (with possible array overlapping).

wmemset (wchar_t dest, wchar_t ch, size_t count)

wchar_t  

Fills count characters specified by ch to the wide character array pointed to by dest.

btowc (int c)

wint_t 

Converts a single-byte character c into its wide-character representation.

wctob (wint_t c)

int 

Converts a wide character c into its single-byte representation.

mbsinit (const mbstate_t ps)

int 

Checks whether the mbstate_t object pointed to by ps is in the initial state.

wcrtomb (char s, wchar_t wc, mbstate_t ps)

size_t 

Converts the wide character specified by wc into a character string and stores the string to the beginning of the character array pointed to by s.

mbrlen (const char s, size_t n, mbstate_t ps)

size_t 

Determines the number of bytes in a character string pointed to by s.

mbsrtowcs (wchar_t dest, const char src, size_t len, mbstate_t ps)

size_t 

Converts a multi-byte character string with a length of len into a wide character string.

wcsrtombs (char dest, const wchar_t src, size_t len, mbstate_t ps)

size_t 

Converts a wide character string into a multi-byte string.

wcstof (const wchar_t str, wchar_t endptr)

float 

Converts a wide character string pointed to by str into a floating-point value and assigns the next character in str after the floating-point value to endptr.

wcstod (const wchar_t *str, wchar_t endptr)

double 

Converts a wide character string pointed to by str into a double value and assigns the next character in str after the double value to endptr.

wcstold (const wchar_t str, wchar_t **endptr)

long double 

Converts a wide character string pointed to by str into a long double value and assigns the next character in str after the long double value to endptr.

wcstol (const wchar_t str, wchar_t endptr, int base)

long 

Converts a wide character string pointed to by str into a long value.

wcstoul (const wchar_t *str, wchar_t endptr, int base)

unsigned long 

Converts a wide character string pointed to by str into an unsigned long value of a specified base.

wcstoll (const wchar_t str, wchar_t **endptr, int base)

long long 

Converts a wide character string pointed to by str into a long long value of a specified base.

wcstoull (const wchar_t str, wchar_t endptr, int base)

unsigned long long 

Converts a wide character string pointed to by str into an unsigned long long value of a specified base.

fwide (FILEstream, int mode)

int 

Sets and determines the orientation of the file stream.

wprintf (const wchar_t format,…)

int 

Prints formatted data to the standard output (stdout).

fwprintf (FILE__restrict fp, const wchar_t restrict fmt,…)

int 

Prints wide character strings to a specified file stream.

swprintf (wchar_t wcs, size_t maxlen, const wchar_t format,…)

int 

Prints formatted data to a specified string.

vwprintf (const wchar_t format, va_list args)

int 

Prints formatted data from a variable argument list to the standard output (stdout).

vfwprintf (FILE stream, const wchar_t *format, isoc_va_list args)

int 

Prints formatted data from a variable argument list specified by args to a specified file stream.

vswprintf (wchar_t wcs, size_t maxlen, const wchar_t format, __isoc_va_list args)

int 

Prints formatted data from a variable argument list specified by args to a specified string.

wscanf (const wchar_t format,…)

int 

Reads formatted data from the standard input (stdin) and stores it based on the wide string format into the locations pointed to by the variable arguments.

fwscanf (FILE stream, const wchar_t format,…)

int 

Reads formatted data from a specified stream and stores it based on the wide string format into the locations pointed to by the variable arguments.

swscanf (const wchar_t ws, const wchar_t format,…)

int 

Reads data from a wide character string pointed to by ws and stores it based on the wide string format into the locations pointed to by the variable arguments.

vwscanf (const wchar_t format, va_list arg)

int 

Reads data from the stdin and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg.

vfwscanf (FILEstream, const wchar_t format, va_list arg)

int 

Reads data from a specified file stream and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg.

vswscanf (const wchar_t ws, const wchar_t format, va_list arg)

int 

Reads data from a string pointed to by ws and stores it based on the wide string format into the locations pointed to by the elements in the variable argument list identified by arg.

fgetwc (FILEstream)

wint_t 

Reads a wide character from a specified file stream.

getwc (FILE stream)

wint_t 

Reads the first wide character from a specified file stream.

getwchar (void)

wint_t 

Reads a wide character from the stdin.

fputwc (wchar_t wc, FILEstream)

wint_t 

Writes a wide character wc to a specified file stream.

putwc (wchar_t wc, FILE stream)

wint_t 

Writes a wide character wc to a specified file stream.

putwchar (wchar_t wc)

wint_t 

Writes a wide character wc to the stdout.

fgetws (wchar_t ws, int n, FILEstream)

wchar_t  

Reads wide characters from a specified file stream.

fputws (const wchar_t ws, FILEstream)

int 

Writes a wide string pointed to by ws to a specified file stream.

ungetwc (wint_t ch, FILE stream)

wint_t 

Pushes a character back into a specified file stream.

mbrtowc (wchar_t pwc, const char s, size_t n, mbstate_t ps)

size_t 

Converts a multi-byte character string with a length of n into a wide character string.

mbsnrtowcs (wchar_t dest, const char src, size_t nwc, size_t len, mbstate_t ps)

size_t 

Converts a multi-byte character string with a length of n into a wide character string that can hold a total of nwc wide characters.

wcsnrtombs (char dest, const wchar_t *src, size_t nwc, size_t len, mbstate_t ps)

size_t 

Converts nwc wide characters in the string pointed to by src into a character string.

wcsdup (const wchar_t s)

wchar_t  

Copies a specified wide character string to a newly allocated buffer.

wcsnlen (const wchar_t s, size_t maxlen)

size_t 

Calculates the length of a wide character string pointed to by s.

wcpcpy (wchar_t dest, const wchar_t src)

wchar_t  

Copies the wide characters (including the terminating null character ‘\0’) pointed to by src to the wide character array pointed to by dest.

wcpncpy (wchar_t dest, const wchar_t src, size_t n)

wchar_t  

Copies n wide characters (including the terminating null character ‘\0’) pointed to by src to the wide character array pointed to by dest.

wcscasecmp (const wchar_t s1, const wchar_t s2)

int 

Compares the wide characters in the string pointed to by s1 with those in the string pointed to by s2, with their case differences ignored.

wcscasecmp_l (const wchar_t s1, const wchar_t s2, locale_t locale)

int 

Compares the wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment, with their case differences ignored.

wcsncasecmp (const wchar_t s1, const wchar_t s2, size_t n)

int 

Compares a maximum of n wide characters in the string pointed to by s1 with those in the string pointed to by s2, with their case differences ignored.

wcsncasecmp_l (const wchar_t s1, const wchar_t s2, size_t n, locale_t locale)

int 

Compares a maximum of n wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment, with their case differences ignored.

wcscoll_l (const wchar_t s1, const wchar_t s2, locale_t locale)

int 

Compares wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment.

wcsftime (wchar_t restrict wcs, size_t n, const wchar_t *restrict f, const struct tm__restrict tm)

size_t 

Converts the date and time in the tm structure to a wide character string.

wcsxfrm_l (wchar_t s1, const wchar_t *s2, size_t n, locale_t locale)

size_t 

Compares the first n wide characters in the string pointed to by s1 with those in the string pointed to by s2 based on the specified locale environment.