SYNOPSIS
#include <wchar.h>
size_t mbrlen(const char *s, size_t n, mbstate_t *ps);
DESCRIPTION
If s is not null, the
mbstate_t internal; mbrtowc(NULL, s, n, ps != NULL ? ps : &internal);
If the specified state pointer is null, the
The behavior of this function is affected by the LC_CTYPE category of the current locale.
PARAMETERS
- s
-
Points to the string whose bytes are to be counted.
- n
-
Specifies the maximum number of bytes to examine.
- ps
-
Is the conversion state. If this is null, an internal mbstate_t object is used.
RETURN VALUES
The
- 0
-
If the next n or fewer bytes complete the character that corresponds to the null wide character.
- positive number
-
If the next n or fewer bytes complete a valid character; the value returned is the number of bytes that complete the character.
- -2
-
If the next n bytes contribute to an incomplete by potentially valid character, and all n bytes have been processed. When n has at least the value of MB_CUR_MAX, this case can only occur if s points at a sequence of redundant shift sequences (for locales with state-dependent encodings).
- -1
-
If an encoding error occurs, in which case the next n or fewer bytes do not contribute to a complete and valid character. In this case, errno is set to EILSEQ, and the conversion state is undefined.
CONFORMANCE
ANSI/ISO 9899-1990/AM 1-1995
MULTITHREAD SAFETY LEVEL
MT-Safe, with exceptions.
This function is MT-Safe as long as no thread calls
PORTING ISSUES
None.
AVAILABILITY
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
mbrtowc() ,mbsinit() ,mbsrtowcs() ,setlocale() ,wcrtomb() ,wcsrtombs()
MKS Toolkit 9.3 Documentation Build 6.