cpp/string/multibyte/wctomb

Converts a wide character to multibyte encoding and stores it (including any shift sequences) in the char array whose first element is pointed to by. No more than characters are stored. The conversion is affected by the current locale's LC_CTYPE category.

If is the null character, the null byte is written to, preceded by any shift sequences necessary to restore the initial shift state.

If is a null pointer, resets the global conversion state and determines whether shift sequences are used.

Return value
If is not a null pointer, returns the number of bytes that are contained in the multibyte representation of  or  if  is not a valid character.

If is a null pointer, resets its internal conversion state to represent the initial shift state and returns  if the current multibyte encoding is not state-dependent (does not use shift sequences) or a non-zero value if the current multibyte encoding is state-dependent (uses shift sequences).