#include <stdlib.h>
int mblen(s, n) char *s; size_t n;
size_t mbstowcs(s, pwcs, n) char *s; wchar_t *pwcs; size_t n;
int mbtowc(pwc, s, n) wchar_t *pwc; char *s; size_t n;
int wcstombs(s, pwcs, n) char *s; wchar_t *pwcs; size_t n;
int wctomb(s, wchar) char *s; wchar_t wcar;
The behavior of these functions is affected by the LC_CTYPE category of the program's locale. For a stat-dependent encoding, each function is placed into its initial state by a call for which its character pointer argument, s, is a NULL pointer. Subsequent calls with s as other than a NULL pointer cause the internal stste of the function to be altered as necessary. A call with a s as a NULL pointer causes these functions to return a nonzero value if encodings have state dependency, and zero otherwise. After the LC_CTYPE category is changed, the shift state of these functions is indeterminate.
If s is not a NULL pointer, these functions work as follows:
No more than n elements will be modified in the array pointed to by pwcs. If copying takes place between objects that overlap, the behavior is undefined.
If s is a null pointer, mblen(), mbtowc(), and wctomb() return a nonzero or zero value, if multibyte character encodings, respectively, do or do not have state dependent encodings.
If s is not a null pointer, mblen() and mbtowc() either return 0 (if s points to the null character), or return the number of bytes that comprise the converted multibyte character (if the next n or fewer bytes form a valid multibyte character), or return -1 (if they do not form a valid multibyte character).
In no case will the value returned by mbtowc() be greater than n or the value of the MB_CUR_MAX macro. If s is not a null pointer, wctomb() returns -1 (if the value does not correspond to a valid multibyte character), or returns the number of bytes that comprise the multibyte character corresponding to wchar.
If an invalid multibyte character is encountered, mbstowcs() and wcstombs() return (size_t) -1. Otherwise, they return the number of bytes modified, not including a terminating null character, if any.
When an application program using these routines is statically linked, user defined multibyte character handling routines in a user provided shared library will not be used.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97