mbtowc
Converts a multibyte character to wchar_t code.
Defined in header <stdlib.h>
Syntax
#include <stdlib.h>
int mbtowc(wchar_t *-pwc, const char *s, size_tn);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ |
Remarks
If s is not null, mbtowc determines the number of bytes that comprise the multibyte character pointed to by s. mbtowc then determines the value of the type wchart that corresponds to that multibyte character. If there is a successful match between wchart and the multibyte character, and pwc is not null, the wchar_t value is stored in the array pointed to by pwc. At most n characters are examined.
Return value
When s points to an invalid multibyte character, -1 is returned. When s points to the NULL character, zero is returned. Otherwise, mbtowc returns the number of bytes that comprise the converted multibyte character.
| The return value will never exceed MB_CUR_MAX | or the value of n. |
See also
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/stdlib.h/mbtowc/
· short form /3.1/mbtowc/