Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

mbsrtowcs - convert multi-byte string to wide-character string

&pagelevel(4)&pagelevel

Syntax

#include <wchar.h>

size_t mbsrtowcs(wchar_t *dst, const char **src, size_t len, mbstate_t *ps); 

Description

mbsrtowcs() converts a sequence of multi-byte characters in the array indirectly pointed to by src to wide characters. mbsrtowcs() starts the conversion with the conversion state described in *ps. The converted characters are written to the array pointed to by dst as long as dst is not a null pointer. Every character is converted as if the mbrtowc() was called.

The conversion terminates when a terminating null character is encountered. The null character is also converted and written into the array.

The conversion is terminated abnormally if

  • a sequence of bytes is found that does not represent a valid multi-byte character or

  • dst is not a null pointer and len characters were written into the array pointed to by dst.

If dst is not a null pointer, the pointer object pointed to by src is assigned one of the following two values:

  • a null pointer if the conversion terminated when it reached a null character

  • the address directly after the last multi-byte character converted

If dst is not a null pointer and the conversion terminated when it reached a null character, then the final state is the same as the “initial conversion” state.

Return val.

The number of successfully converted multi-byte characters.

 


if successful. The terminating null character (if present) is not counted.

 

(size_t)-1

if a conversion error occurred, i.e. a sequence of bytes that does not represent a valid multi-byte character was found. The value of the EILSEQ macro is written in errno. The conversion status is undefined.

See also

mblen(), mbtowc(), wcstombs(), wctomb().