HP C/iX Library Reference Manual (30026-90004)

398 Chapter5
HP C/iX Library Function Descriptions
wcstombs
wcstombs
Converts a sequence of wide character codes to a sequence of multibyte characters.
Syntax
#include <stdlib.h>
size_t wcstombs(char *
s
, const wchar_t *
pwcs
, size_t
n
);
Parameters
s
A pointer to a character array to which the converted multibyte characters
are returned.
pwcs
A pointer to the sequence of wide characters to be converted.
n
A variable of type size_t indicating the maximum number of bytes to
return.
Return Values
x The number of array elements modified, not including a terminating zero.
1 Invalid wide character found.
Description
The sequence of wide character codes from the array pointed to by
pwcs
are converted into
a sequence of multibyte characters and stored in the array pointed to by
s
. The conversion
ends when a null character is stored or
n
is reached, whichever occurs first.
If a code is encountered that does not correspond to a valid multibyte character, wcstombs
returns (size_t)-1. Otherwise, this function returns the number of bytes modified (not
including a terminating null character, if any).
See Also
mblen(), mbstowcs(), mbtowc(), wctomb(), ANSI C 4.10.8.2