User Tools

Site Tools


solaris:c16rtomb.3c

c16rtomb


NAME

c16rtomb - restartable multibyte/wide character conversion function

SYNOPSIS

#include <uchar.h>
size_t c16rtomb
(char * restrict s, char16_t c16, mbstate_t * restrict ps);

DESCRIPTION

If s is a null pointer, the c16rtomb() function is equivalent to the call

c16rtomb(buf, L’ ’, ps)

where buf is an internal buffer.

If s is not a null pointer, the c16rtomb() function determines the number of bytes needed to represent the multibyte character that corresponds to the wide character given by c16 (including any shift sequences), and stores the multibyte character representation in the array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If c16 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 VALUES

The c16rtomb() function returns the number of bytes stored in the array object (including any shift sequences). When c16 is not a valid wide character, an encoding error occurs: the function stores the value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion state is unspecified.

ERRORS

The c16rtomb() function will fail if:

EINVAL

The ps argument points to an object that contains an invalid conversion state.

EILSEQ

Invalid character sequence is detected.

The c16rtomb() function may fail if:

ENOMEM

Insufficient storage space is available.

ATTRIBUTES

See attributes(7) for descriptions of the following attributes:

SEE ALSO

mbsinit(3C), setlocale(3C), attributes(7), standards(7)

NOTES

If ps is not a null pointer, the function uses the mbstate_t object pointed to by ps and the function can be used safely in multithreaded applications. If ps is a null pointer, the function uses its internal mbstate_t object and the function is Unsafe in multithreaded applications.


solaris/c16rtomb.3c.txt · Last modified: 2023/07/19 08:58 by A User Not Logged in