wctomb(3int)
Name
wctomb − converts a character of type wchar_t to a multibyte character.
Syntax
#include <stdlib.h>
int wctomb (s, wchar)
char *s;
wchar_t wchar;
Arguments
s The s argument is a pointer to the resulting multibyte character object.
wchar The wchar argument is a value of type wchar_t.
Description
The wctomb() function determines the number of bytes needed to represent the multibyte character corresponding to the character code of type wchar_t whose value is wchar. It stores the multibyte character representation in the array object pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters are stored. This function is affected by the LC_CTYPE category of the current locale.
Return Value
If s is a null pointer, the wctomb() function returns a zero value. If s is not a null pointer, the wctomb() function returns:
•- -1, if the value of wchar does not correspond to a valid multibye character
•The number of bytes that comprise the multibyte character corresponding to the value of wchar. In no case is the value returned greater than the value of the MB_CUR_MAX macro.
See Also
mblen(3int), mbtowc(3int), mbstowcs(3int), setlocale(3int), wcstombs(3int)