cpp/string/multibyte/wcstombs

Converts a sequence of wide characters from the array whose first element is pointed to by to its narrow multibyte representation that begins in the initial shift state. Converted characters are stored in the successive elements of the char array pointed to by. No more than bytes are written to the destination array.

Each character is converted as if by a call to std, except that the wctomb's conversion state is unaffected. The conversion stops if:
 * The null character was converted and stored.
 * A was found that does not correspond to a valid character in the current C locale.
 * The next multibyte character to be stored would exceed.

Return value
On success, returns the number of bytes (including any shift sequences, but excluding the terminating ) written to the character array whose first element is pointed to by.

On conversion error (if invalid wide character was encountered), returns.