c/string/multibyte/wcsrtombs

@1@ 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 wcrtomb. The conversion stops if: @2@ Same as, except that
 * The null character was converted and stored. The bytes stored in this case are the unshift sequence (if necessary) followed by,  is set to null pointer value 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.
 * the function returns its result as an out-parameter
 * if the conversion stops without writing a null character, the function will store in the next byte in, which may be  or , whichever comes first (meaning up to len+1/dstsz+1 total bytes may be written). In this case, there may be no unshift sequence written before the terminating null.
 * the function clobbers the destination array from the terminating null and until
 * If and  overlap, the behavior is unspecified.
 * the following errors are detected at runtime and call the currently installed constraint handler function:
 * ,, , or is a null pointer
 * or is greater than rsize_max (unless  is null)
 * is not zero (unless is null)
 * is greater than and the conversion does not encounter null or encoding error in the  array by the time  is reached (unless  is null)

Return value
@1@ 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. On conversion error (if invalid wide character was encountered), returns, stores eilseq in errno, and leaves in unspecified state. @2@ Returns zero on success (in which case the number of bytes excluding terminating zero that were, or would be written to, is stored in ), non-zero on error. In case of a runtime constraint violation, stores in  (unless  is null) and sets  to  (unless  is null or  is zero or greater than rsize_max)