Convert a character string to a wide-character string
#include <wchar.h>
size_t mbsrtowcs( wchar_t * dst,
const char ** src,
size_t n,
mbstate_t * ps );
libc
The mbsrtowcs() function converts a string of multibyte characters pointed to by src into the corresponding wide characters pointed to by dst, to a maximum of n bytes, including the terminating NULL character.
The function converts each character as if by a call to mbtowc() and stops early if:
Or:
The ps variable is an internal pointer that allows mbsrtowcs() to be a restartable version of mbstowcs(); if ps is a NULL pointer, mbsrtowcs() uses its own internal pointer.
This function is affected by LC_TYPE.
The mbsrtowcs() function is the restartable version of mbstowcs().
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
"Multibyte character functions" and "Wide-character functions" in the summary of functions chapter.