SYNOPSIS
#include <wchar.h>
size_t mbrlen(const char *s, size_t n, mbstate_t *ps);
#include <wchar.h>
#include <locale.h>
size_t mbrlen_l(const char *s, size_t n, mbstate_t *ps, locale_t locale);
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.
- locale
-
Is a locale_t perhaps returned by
newlocale() or LC_GLOBAL_LOCALE or 0 for the current thread locale set withuselocale() .
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 (or MB_CUR_MAX_L), 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
MULTITHREAD SAFETY LEVEL
MT-Safe, with exceptions.
The
The function
PORTING ISSUES
None.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
mbrtowc() ,mbrtowc_l() ,mbsinit() ,mbsinit_l() ,mbsnrtowcs() ,mbsnrtowcs_l() ,mbsrtowcs() ,mbsrtowcs_l() ,newlocale() ,setlocale() ,wcrtomb() ,wcrtomb_l() ,wcsrtombs() ,wcsrtombs_l()
PTC MKS Toolkit 10.4 Documentation Build 39.