size_t wcrtomb_l(char *s, wchar_t wc, mbstate_t *ps, locale_t loc);
If s is a null pointer, wcrtomb_l function is equivalent to the call wcrtomb_l(buf, L'\0', ps, loc) where buf is an internal buffer.
If s is not a null pointer, wcrtomb_l determines the number of bytes needed to represent the multibyte character that corresponds to the wide character given by wc, and stores the multibyte character representation in the array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If wc is a null wide character, a null byte is stored; the resulting state described is the initial conversion state.
wcrtomb_l returns the number of bytes stored in the array object. When wc is not a valid wide character, an encoding error occurs: wcrtomb_l stores the value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion state is unspecified.