mblen(S) 6 January 1993 mblen(S) Name mblen, mbtowc, mbstowcs, wctomb, wcstombs - multibyte character routines Syntax cc . . . -lc #include <stdlib.h> int mblen (s, len) const char *s; size_t len; int mbtowc (pwc, s, len) wchar_t *pwc; const char *s; size_t len; size_t mbstowcs (pwcs, s, len) wchar_t *pwcs; const char *s; size_t len; int wctomb (s, wchar) char *s; wchar_t wchar; size_t wcstombs (s, pwcs, len) char *s; const wchar_t *pwcs; size_t len; Description These routines handle multibyte characters. A multibyte character is simply a character spread across more than one byte. Wide characters contain more than 8 bits in a character. The wchart type defines a wide character. In routines specifying such, the s argument points to an array of bytes. The len argument is the length of the array. If s is null, a value of zero is always returned. The mblen routine returns the length of a multibyte character. The mbtowc routine translates a single multibyte character pointed to by s to a multibyte character, storing the result in the array pointed to by pwc. The number of bytes stored in pwc is returned. The mbstowcs routine translates a multibyte character pointed to by s to a wide character string, storing the result in the string pointed to by pwc. The number of wide characters stored in pwc is returned. The wctomb routine translates a wide character pointed to by wchar into a multibyte character array pointed to by s. The number of bytes stored in s is returned. The wcstombs routine translates a wide character string pointed to by pwcs into a multibyte character string pointed to by s. The number of bytes stored in s is returned (not counting the null byte terminating the string). Return values mblen returns the length if successful; otherwise, a value of zero is returned if the string pointer is null, or -1 is returned if the length is zero bytes. mbtowc returns the length if successful; otherwise, a value of zero is returned if the string pointer is null. When zero is returned, pwc is also set to null. mbstowcs returns the length if successful; otherwise, a value of zero is returned if the string pointer is null. If an invalid character is encountered in the string, processing stops and -1 is returned. wctomb returns the length if successful; otherwise, a value of zero is returned if the string pointer is null. If the wide character length is zero bytes, zero is returned. Standards conformance These routines conform to: IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1).