c16rtomb(), c32rtomb()

Updated: May 06, 2022

Convert a wide character into a multibyte character

Synopsis:

#include <uchar.h>

size_t c16rtomb( char *s,
                 char16_t wc,
  	         mbstate_t *pst );

size_t c32rtomb( char *s,
                 char32_t wc,
  	         mbstate_t *pst );

Arguments:

s
NULL, or an array of characters where the function can store the multibyte character.
wc
The wide character that you want to convert.
pst
A pointer to a conversion object that's used to store state information so that the function can be restarted. You can call mbsinit() to determine the status of this variable.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The c16rtomb() and c32rtomb() functions determine the number of bytes needed to convert a wide character into a multibyte character, if possible. If s isn't NULL, the functions actually do the conversion.

Returns:

The number of bytes needed to convert the wide character, or -1 if wc isn't a valid wide character.

Classification:

C11

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