cpp/string/multibyte/wcsrtombs

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 conversion state described by. If is not null, 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. The conversion stops if:
 * The null character was converted and stored. is set to a null pointer and  represents the initial shift state.
 * A was found that does not correspond to a valid character in the current C locale.  is set to point at the first unconverted wide character.
 * The next multibyte character to be stored would exceed . is set to point at the first unconverted wide character. This condition is not checked if  is a null pointer.

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. If is a null pointer, returns the number of bytes that would have been written (again, excluding the terminating null character ).

On conversion error (if invalid wide character was encountered), returns, stores eilseq in errno, and leaves in unspecified state.