Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

wcsrtombs - convert wide character string to multi-byte string

&pagelevel(4)&pagelevel

Syntax

#include <wchar.h>

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

Description

wcsrtombs() converts a sequence of wide characters in the array indirectly pointed to by src to multi-byte characters. wcsrtombs() 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 wcrtomb() 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 the next multi-byte character would exceed the entire length len of characters to be written into the array.

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.

(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.


The number of successfully converted multi-byte characters (the terminating null character, if present, is not counted)



otherwise

See also

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