Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

mbtowc - convert multi-byte character to wide character

&pagelevel(4)&pagelevel

Syntax

#include <stdlib.h>

int mbtowc(wchar_t *pwc, const char *s, size_t n); 

Description

mbtowc() converts a multi-byte character in s to the corresponding wchar_t value and
stores this value in the area pwc. A maximum of n bytes in s are evaluated.

The wchar_t value (type long) stored by mbtowc() in the area pwc corresponds to the
value of the byte in s.

No assignment takes place if:
pwc or s is a null pointer, or n = 0.

Return val.

-1

0

1

if n = 0.

if s is a null pointer or points to a null byte.

in all other cases.

Notes

No characters consisting of multiple bytes are implemented in this version. Multi-byte
characters always have a length of 1 byte, and wchar_t values are always of type long.

See also

mblen(), mbstowcs(), wcstombs(), wctomb(), stdlib.h.