#include <stdlib.h>
|
|
int
mblen (const char *mbchar, size_t nbytes); |
Otherwise, if
mbchar
is not a null pointer,
mblen
either returns 0 if
mbchar
represents the null wide character, or returns
the number of bytes processed in
mbchar,
or returns -1 if no multibyte character
could be recognized or converted.
In this case,
mblen (Ns, ’s);
internal conversion state is undefined.
A call with a null mbchar pointer returns nonzero if the current locale requires shift states, zero otherwise; if shift states are required, the shift state is reset to the initial state.
The behavior of the mblen is affected by LC_CTYPE category of the current locale.
#include <stdlib.h>
#include <wchar.h>
/* Illustrates how to use mblen API */
int example_mblen(wchar_t wc)
{
int len;
/* determine the number bytes in the multibyte char */
len = mblen(wc, MB_CUR_MAX);
if(len == -1)
{
wprintf(L"mblen returned error!!\n");
}
/* return the no of bytes */
return(len);
}
| [EILSEQ] | |
| An invalid multibyte sequence was detected. | |
| [EINVAL] | |
| The internal conversion state is not valid. | |
|
© 2005-2007 Nokia |