QNX Developer Support
Convert a multibyte character into a wide character (restartable)
#include <wchar.h> size_t mbrtowc( wchar_t * pwc, const char * s, size_t n, mbstate_t * ps );
- A pointer to a wchar_t object where the function can store the wide character.
- A pointer to the multibyte character that you want to convert.
- The maximum number of bytes in the multibyte character to convert.
- An internal pointer that lets mbrtowc() be a restartable
if ps is NULL, mbrtowc() uses its
own internal variable.
You can call mbsinit() to determine the status of this variable.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The mbrtowc() function converts single multibyte characters pointed to by s into wide characters pointed to by pwc, to a maximum of n bytes (not characters).
This function is affected by LC_TYPE.
- After converting all n characters, the resulting conversion state indicates an incomplete multibyte character.
- The function detected an encoding error before completing the next multibyte character; the function sets errno to EILSEQ and leaves the resulting conversion state undefined.
- The next completed character is a null character; the resulting conversion state is the same as the initial one.
- The number of bytes needed to complete the next multibyte character, in which case the resulting conversion state indicates that x bytes have been converted.
- Invalid character sequence.
- The ps argument points to an invalid object.