Converts a sequence of multibyte characters into their corresponding wide-character codes and stores them in an array.
#include <wchar.h> size_t mbsrtowcs ( wchar_t *dst, const char **src, size_t len, mbstate_t *ps);
(OUT) Points to the array of wide-character codes.
(IN) Points to the array of multibyte characters to be converted.
(IN) Specifies the number of codes to be stored in the array pointed to by dst.
(IN) Points to the conversion state of the character sequence. If ps is a NULL pointer, mbsrtowcs uses its own state, which is initialized at startup. A thread-safe application must not pass a NULL pointer.
If successful, returns the actual number of characters converted, not including the null-terminating character (if any).
If an error occurs, returns -1 and sets errno to the following:
The mbsrtowcs function converts a sequence of multibyte characters pointed to by src into their corresponding wide-character codes and stores not more than len codes into the array pointed to by dst.
The mbsrtowcs function does not convert any multibyte characters beyond the null-terminating character. Conversion continues up to and including a null-terminating character, which is also stored. At most, len elements of the array pointed to by src are modified. If a null-terminating character is not encountered in the len elements, the dst string is not null terminated.
The behavior of this function is affected by the LC_CTYPE category of the current locale.