wcrtomb()

Converts a wide character to a multibyte character.

  #include <wchar.h>
  
  int wcrtomb(char *s, wchar_t wchar, mbstate_t * ps);    
Parameter

s

A pointer to a multibyte character buffer of at least MB_CUR_MAX characters long.

wchar

A wide character to convert.

ps

A pointer to a multibyte conversion state. Ignored if the encoding scheme is non-modal.

Remarks

This function ranslates a wchar_t type to a multibyte character according to the encoding scheme specified in the LC_CTYPE component of the current locale. Thisfunction operates identically to wctomb() except that it has an additional parameter of type mbstate_t*, which is ignored if the encoding scheme is non-modal.

If s a null pointer, this call is equivalent to wcrtomb(buf, L'\0', ps)where buf is an internal buffer. If s is not a null pointer, the function determines the length of the UTF-8 multibyte encoding that corresponds to the wide character wchar and stores that sequence in the multibyte string pointed to by s. At most MB_CUR_MAX bytes are stored. The function returns the number of bytes stored in the string s.