Converts a sequence of wide characters into a sequence of corresponding multibyte characters.
#include <wchar.h>
size_t wcsrtombs (char *dst, const wchar_t **src,
size_t len, mbstate_t *ps);
Function Variants
This function also has variants named _wcsrtombs32 and _wcsrtombs64
for use with 32-bit and 64-bit pointer sizes, respectively. See
Section 1.8 for more information on using
pointer-size-specific functions.
If dst is a not NULL pointer, the converted characters are then stored into the array pointed to by dst. Conversion continues up to and including a terminating null wide character, which is also stored.
Conversion stops earlier in two cases:
Each conversion takes place as if by a call to the wcrtomb function.
If dst is not a NULL pointer, the pointer object pointed to by src is assigned either a NULL pointer, (if the conversion stopped because it reached a terminating null wide character) or the address just beyond the last wide character converted (if any). If conversion stopped because it reached a terminating null wide character, the resulting state described is the initial conversion state.
If the wcsrtombs function is called as a counting function, which means that dst is a NULL pointer, the value of the internal mbstate_t object will remain unchanged.
See also wcrtomb in this section.
| x | The number of bytes stored in the resulting array, not including the terminating null (if any). |
| -1 | Indicates an encoding error-a character that does not correspond to a valid multibyte character was encountered; errno is set to EILSEQ; the conversion state is undefined. |