[Previous] [Contents] [Next]

wcrtomb()

Convert a wide-character code to a character

Synopsis:

#include <wchar.h>

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

Library:

libc

Description:

The wcrtomb() function determines the number of bytes needed to represent the wide character wc as a multibyte character and stores the multibyte character in the location pointed to by s, to a maximum of MB_CUR_MAX bytes.

The wcrtomb() function uses ps to make it thread safe; if ps is a NULL pointer, wcrtomb() uses its own internal pointer.

This function is affected by LC_CTYPE.

Returns:

(size_t)-1
Failure; the variable wc is an invalid wide-character code.
x
Success; the number of bytes stored.

Errors:

EILSEQ
Invalid wide-character code.
EINVAL
The variable ps points to an invalid conversion state.

Classification:

ANSI

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

"String manipulation functions" and "Wide-character functions" in the summary of functions chapter.


[Previous] [Contents] [Next]