C Language: wcstombs function
(Convert Wide Character String to Multibyte String)
In the C Programming Language, the wcstombs function converts a wide character string (as pointed to by pwcs) into a multibyte string (as pointed to by s) up to n bytes in length.
Syntax
The syntax for the wcstombs function in the C Language is:
size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
Parameters or Arguments
- s
- The array where the converted multibyte string will be stored.
- pwcs
- The wide character string to convert into a multibyte string.
- n
- The maximum number of bytes to store in s.
Note
- The wcstombs function will end the conversion if a null character is stored or if n bytes is reached.
Returns
The wcstombs function returns the number of bytes stored (not including the null character). The wcstombs function will return -1 if it encountered a character that does not correspond to a valid multibyte character.
Required Header
In the C Language, the required header for the wcstombs function is:
#include <stdlib.h>
Applies To
In the C Language, the wcstombs function can be used in the following versions:
- ANSI/ISO 9899-1990
Similar Functions
Other C functions that are similar to the wcstombs function:
See Also
Other C functions that are noteworthy when dealing with the wcstombs function:
Advertisements