wcrtomb()
QNX SDP8.0C Library ReferenceAPIDeveloper
Convert a wide-character code to a character
Synopsis:
#include <wchar.h>
size_t wcrtomb( char * s,
wchar_t wc,
mbstate_t * ps);
Arguments:
- s
- NULL, or a pointer to a location where the function can store the multibyte character.
- wc
- The wide character that you want to convert.
- ps
- An internal pointer that lets wcrtomb() be a restartable version of
wctomb();
if ps is NULL, wcrtomb() uses its
own internal variable.
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:
If s isn't NULL, the wcrtomb() function converts the wide character wc into a multibyte character. The multibyte character is stored in the location referenced by s, to a maximum of MB_CUR_MAX bytes.
If s is NULL, the function call is equivalent to
wcrtomb(buf, L'\0', ps)
where buf is an internal buffer. The mbstate_t object referenced by ps is then reset to its initial conversion state.This function is affected by LC_CTYPE.
Returns:
The number of bytes stored, or (size_t)-1
if the variable
wc is an invalid wide-character code.
Errors:
- EILSEQ
- Invalid wide-character code.
- EINVAL
- The variable ps points to an invalid conversion state.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Read the Caveats |
Caveats:
This function is safe to call in a multithreaded program if the ps argument isn't NULL.
Page updated: