MBSTOWCS(3) | Library Functions Manual | MBSTOWCS(3) |
mbstowcs
—
converts a multibyte character string to a wide-character
string
#include
<stdlib.h>
size_t
mbstowcs
(wchar_t
* restrict pwcs, const
char * restrict s, size_t
n);
mbstowcs
()
converts a null-terminated multibyte character string pointed to by
s to the corresponding wide-character string and
stores up to n wide characters in the array pointed to
by pwcs. Each character will be converted as if
mbtowc(3) is continuously called, except
the internal state of mbtowc(3) will not
be affected.
For state-dependent encoding,
mbstowcs
()
implies the multibyte character string pointed to by s
always begin with an initial state.
These are the special cases:
mbstowcs
()
returns the number of elements to store the whole wide-character string
corresponding to the multibyte character string pointed to by
s. In this case, n is
ignored.mbstowcs
() returns:
mbstowcs
() sets errno to
indicate the error.mbstowcs
() may cause an error in the
following cases:
EILSEQ
]The mbstowcs
() function conforms to
ANSI X3.159-1989 (“ANSI C89”).
The restrict qualifier is added at ISO/IEC 9899/199 (“ISO
C99”).
October 24, 2015 | OpenBSD-current |