HELPLIB.HLB  —  CRTL  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);

1  –  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.

2  –  Description

    The wcstombs 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.

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

    See also wctomb.

3  –  Return Values

    x                  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.
Close Help