Converts a multibyte character string to a wide character string.
#include <stddlib.h> size_t mbsrtowcs(wchar_t *pwcs, const char **s, size_t n, mbstate_t * ps);
pwcs
A pointer to a wide character string in which to store the converted string.
s
A pointer to a pointer to the multibyte string to convert.
n
The maximum number of wide characters to store at pwcs.
ps
The current state of conversion. Ignored if the encoding scheme is non-modal.
This function operates identically to the same as mbstowcs() except that it has an additional parameter of type mbstate_t*, which is ignored if the encoding scheme is non-modal. Also, this function returns extra information about the conversion in the s argument.
The EWL implementation of mbsrtowcs() converts a sequence of multibyte characters encoded according to the scheme specified in the LC_CTYPE component of the current locale, indirectly pointed to by s. If pwcs is not a null pointer, the function stores not more than n of the corresponding Unicode characters. The function stops if it reaches a null character or an invalid multibyte character and stores a null wide character to terminate the wide character string at pwcs.
If conversion stops because of a terminating null character, the function stores a null pointer in the object pointed to by s. Otherwise, the function stores a pointer to the address just beyond the last multibyte character converted, if any.
The function returns the number of multibyte characters successfully converts, not including the terminating null character. If the function encounters an invalidly encoded multibyte character, it stores the value of EILSEQ in errno and returns the value (size_t)(-1).