Converts a wide-character code to a multibyte character (restartable).
#include <wchar.h>
size_t wcrtomb (
char *s,
wchar_t wc,
mbstate_t *ps);
(OUT) Points to the converted multibyte character. If no conversion is needed, this can be a NULL pointer.
(IN) Specifies the wide-character code.
(IN) Points to the conversion state of the character sequence. If ps is a NULL pointer, wcrtomb uses its own state, which is initialized at program startup. A thread-safe application must not pass a NULL pointer.
If successful, returns the number of bytes in the wide-character code, including any shift sequences. Otherwise, returns -1 and sets errno to one of the following:
The wcrtomb function determines the number of bytes needed to represent the character that corresponds to the wide character given by wc (including any shift sequences). If s is not a NULL pointer, the multibyte character representation is stored in the array pointed to by s. At most, MB_CUR_MAX characters are stored.