Converts a wide character to its multibyte character
representation.
Format
#include <stdlib.h>
int wctomb (char *s, wchar_t wchar);
1 – Arguments
s
A pointer to the resulting multibyte character.
wchar
The code for the wide character.
2 – Description
The wctomb function converts the wide character specified by
wchar to its multibyte character representation. If s is NULL,
then 0 is returned. Otherwise, the number of bytes comprising the
multibyte character is returned. At most, MB_CUR_MAX bytes are
stored in the array object pointed to by s.
This function is affected by the LC_CTYPE category of the
program's current locale.
3 – Return Values
x The number of bytes comprising the multibyte
character corresponding to wchar.
0 If s is NULL.
-1 If wchar is not a valid character.