MBSRTOWCS(3) NEWLIB MBSRTOWCS(3)NAME
2.27 `mbsrtowcs', `mbsnrtowcs'--convert a character string to a wide-
character string
SYNOPSIS
#include <wchar.h>
size_t mbsrtowcs(wchar_t *DST, const char **SRC, size_t LEN,
mbstate_t *PS);
#include <wchar.h>
size_t _mbsrtowcs_r(struct _reent *PTR, wchar_t *DST,
const char **SRC, size_t LEN,
mbstate_t *PS);
#include <wchar.h>
size_t mbsnrtowcs(wchar_t *DST, const char **SRC,
size_t NMS, size_t LEN, mbstate_t *PS);
#include <wchar.h>
size_t _mbsnrtowcs_r(struct _reent *PTR, wchar_t *DST,
const char **SRC, size_t NMS,
size_t LEN, mbstate_t *PS);
DESCRIPTION
The `mbsrtowcs' function converts a sequence of multibyte characters
pointed to indirectly by SRC into a sequence of corresponding wide
characters and stores at most LEN of them in the wchar_t array pointed
to by DST, until it encounters a terminating null character (' ').
If DST is NULL, no characters are stored.
If DST is not NULL, the pointer pointed to by SRC is updated to
point to the character after the one that conversion stopped at. If
conversion stops because a null character is encountered, *SRC is set
to NULL.
The mbstate_t argument, PS, is used to keep track of the shift
state. If it is NULL, `mbsrtowcs' uses an internal, static mbstate_t
object, which is initialized to the initial conversion state at program
startup.
The `mbsnrtowcs' function behaves identically to `mbsrtowcs', except
that conversion stops after reading at most NMS bytes from the buffer
pointed to by SRC.
RETURNS
The `mbsrtowcs' and `mbsnrtowcs' functions return the number of wide
characters stored in the array pointed to by DST if successful, other‐
wise it returns (size_t)-1.
PORTABILITY
`mbsrtowcs' is defined by the C99 standard. `mbsnrtowcs' is defined by
the POSIX.1-2008 standard.
SEE ALSOmbsrtowcs is part of the library. The full documentation for is main‐
tained as a Texinfo manual. If info and are properly installed at your
site, the command
info
will give you access to the complete manual.
NEWLIB April 2010 MBSRTOWCS(3)