wctomb function — Converts a wide character to a multibyte character
int wctomb(char* s, wchar_t wc)
The wctomb
function
converts a wide character to a multibyte character. It first
determines the number of bytes needed to represent wc
as a multibyte character. If s
is not null, the sequence of multibyte
characters is stored there. At most, MB_CUR_MAX
bytes are stored, and the
return value is the actual number of bytes written to s
. If wc
does not have a valid multibyte
encoding, -1
is returned.
If s
is null, the return
value is true (nonzero) if multibyte characters have state-dependent
encodings, or false (0
) if they
do not.