Guardian C Library Calls Reference Manual
mbtowc
3-116 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
mbtowc
The mbtowc function converts a multibyte character to a wide character. The argument s
points to the beginning of a multibyte character that is not more than n characters long.
The function converts the character to its wide character representation, storing the result
in the variable pointed to by pwc, if pwc is not a null pointer.
pwc
points to the variable of type wchar_t that will contain the wide character encoding.
s
points to the multibyte character.
n
defines the maximum length in bytes of the array pointed to by s that the mbtwoc
function will examine.
Return Value
If s is a null pointer,.the return value is 0.
If s is not a null pointer, the return value is:
Usage Guidelines
•
The behavior of the mbtowc function is affected by the LC_CTYPE category of the
current locale.
#include <stdlibh>
int mbtowc(wchar_t *pwc, const char *s, size_t n);
0
if s points to a null character
1
if s points to a one-byte character, different from null
2
if s points to the first byte of a two-byte character
-1
if none of the above is true