Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

wcrtomb - Convert wide character to multibyte character

&pagelevel(4)&pagelevel

Definition  

#include <wchar.h>

size_t wcrtomb(char *s, wchar_t wc, mbstate_t *ps);

If s is a null pointer, wcrtomb is equivalent to the call
wcrtomb(buf, L'\0', ps)
where buf designates an internal buffer.

If s is not a null pointer, the wcrtomb function determines the number of bytes needed to represent the multibyte character that corresponds to the wide character given by wc (including any shift sequences), and stores the resulting bytes 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, preceded by any shift sequence needed to restore the initial shift state.

The resulting state described is the initial conversion state.

Return val.

(size_t)-1

if wc is not a valid wide character. The value of the EILSEQ macro is storedin errno, and the conversion state is undefined.


Number of bytes written to the array pointed to by *s



otherwise.

Note

This version of the C runtime system only supports one-byte characters as wide character codes.

See also

mblen, mbtowc, wcstombs, wctomb