[Previous] [Contents] [Next]

wcsrtombs()

Convert a wide-character string to a character string

Synopsis:

#include <wchar.h>

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

Library:

libc

Description:

The wcsrtombs() function converts a string of wide-characters pointed to by src into the corresponding multi-byte characters pointed to by dst. No more than len bytes are stored, including the terminating NULL character.

The function converts each character as if by a call to wctomb() and stops early if:

The wcsrtombs() function uses ps to make it thread safe; if ps is a NULL pointer, wcsrtombs() uses its own internal pointer.

Returns:

(size_t)-1
Failure; invalid wide-character code
x
Success; the number of total bytes successfully converted, not including the terminating NULL byte.

Classification:

ANSI

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

"String manipulation functions" and "Wide-character functions" in the summary of functions chapter.


[Previous] [Contents] [Next]