MBTOWC(3,L) AIX Technical Reference MBTOWC(3,L)
-------------------------------------------------------------------------------
mbtowc, mbstowcs, mbstomb
PURPOSE
Converts multibyte characters and multibyte character strings into wide
characters and wide character strings.
SYNTAX
#include <string.h>
#inclued <mbcs.h>
int mbtowc (pwc, s, n)
wchar_t *pwc
char *s;
size_t n;
size_t mbstowcs (wcs, s, n)
wchar_t *wcs;
char *s;
size_t n;
int mbstomb (mbch, mbs, n)
mbchar_t *mbch;
char *mbs;
size_t n;
DESCRIPTION
The mbtowc subroutine converts a multibyte character to a wide character,
returns the number of bytes of the multibyte character and stores the result in
s. If pwc is a NULL pointer, the number of bytes needed to convert s to a wide
character is returned.
The mbstowcs subroutine converts the string of multibyte characters s to a wide
character string and stores the result in wcs. No more than n wide characters
are placed in the wcs string.
The mbstomb subroutine converts the first multibyte character in the string mbs
to a character of a type mbchar_t and places it in mbch without changing its
value. No more than n bytes can be placed in the mbchar_t character. The file
code used to define the multibyte character is specified by the LC_CTYPE or the
LC_ALL category of the locale.
RETURN VALUE
The mbtowc subroutine returns:
Processed November 7, 1990 MBTOWC(3,L) 1
MBTOWC(3,L) AIX Technical Reference MBTOWC(3,L)
m where m is the number of bytes converted.
-1 if s does not contain a valid multibyte character.
0 if s is a NULL pointer.
The mbstwcs subroutine returns:
m where m is the number of wide characters converted.
-1 if s does not contain a valid multibyte character.
0 if s is a NULL pointer.
The mbstomb subroutine returns:
m where m is the number of bytes in the multibyte character.
-1 if mbch or mbs is a NULL pointer, or if the first multibyte character in
mbs exceeds n.
RELATED INFORMATION
In this book: "wctomb, wcstombs" and "setlocale."
The mbcsgen command in AIX Operating System Commands Reference.
AIX Guide to MultiByte Character Set (MBCS) Support.
Processed November 7, 1990 MBTOWC(3,L) 2