Borland C++ reference

mbtowc

raw OCR

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

DOSUNIXWindowsANSI CC++ 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_MAXor the value of n.

See also

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.