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 multibyte character to wide character

&pagelevel(4)&pagelevel

Definition

#include <stdlib.h>

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

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

The wide character 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

  • n = 0.

Return val.

-1                     if n = 0.

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

1                      otherwise.

Note

This version of the C runtime system only supports one-byte characters as wide character
codes. Multibyte characters and wide characters always have a length of 1 byte.

See also

mblen, mbstowcs, wcstombs, wctomb