wcstombs

Converts a sequence of wide-character codes to a sequence of multibyte characters.

Format

#include  <stdlib.h>

size_t wcstombs  (char *s, const wchar_t *pwcs,
                 size_t n);

Arguments

s
A pointer to the array containing the resulting multibyte characters.
pwcs
A pointer to the array containing the sequence of wide-character codes.
n
The maximum number of bytes to be stored in the array pointed to by s.

Description

This function converts a sequence of codes corresponding to multibyte characters from the array pointed to by pwcs to a sequence of multibyte characters that are stored into the array pointed to by s, up to a maximum of n bytes. The value returned is equal to the number of characters converted or a -1 if an error occurred.

This function is affected by the LC_CTYPE category of the program's current locale. See also wctomb in this section.

If s is NULL, this function call is a counting operation and n is ignored.

Return Values
The number of bytes stored in s, not including the null terminating byte. If s is NULL, wcstombs returns the number of bytes required for the multibyte character array. 
(size_t) -1  Indicates an error occurred. The function sets errno to EILSEQ - invalid character sequence, or a wide-character code does not correspond to a valid character. 


Previous Page | Next Page | Table of Contents | Index