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 characters to multi-byte characters

&pagelevel(4)&pagelevel

Syntax

#include <wchar.h>

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

Description

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

If s is not a null pointer, wcrtomb() determines how many bytes are required to represent the multi-byte character corresponding to wc. Any Shift sequences are also taken into account. The resulting bytes are written to the array whose first element is pointed to by s.
A maximum of {MB_CUR_MAX} bytes are written.
If wc is the null character, a null byte is written that can preceded a Shift sequence that restores the initial conversion state.

The final state corresponds to the “initial conversion” state.

Return val.

(size_t)-1

if wc does not represent a valid wide character. The value of the EILSEQ macro is written to errno. The conversion status is undefined.


the number of bytes written to the array *s



otherwise

Notes

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

See also

mblen(), mbtowc(), wcstombs(), wctomb().