HELPLIB.HLB  —  CRTL  wcrtomb
    Converts the wide character to its multibyte character
    representation.

    Format

      #include  <wchar.h>

      size_t wcrtomb  (char *s, wchar_t wc, mbstate_t *ps);

1  –  Arguments

 s

    A pointer to the resulting multibyte character.

 wc

    A wide character.

 ps

    A pointer to the mbstate_t object. If a NULL pointer is
    specified, the function uses its internal mbstate_t object.
    mbstate_t is an opaque datatype intended to keep the conversion
    state for the state-dependent codesets.

2  –  Description

    If s is a NULL pointer, the wcrtomb function is equivalent to the
    call:

       wcrtomb (buf, L'\0', ps)

    where buf is an internal buffer.

    If s is not a NULL pointer, the wcrtomb function determines the
    number of bytes needed to represent the multibyte character that
    corresponds to the wide character specified by wc (including any
    shift sequences), and stores the resulting bytes in the array
    whose first element is pointed to by s. At most MB_CUR_MAX bytes
    are stored.

    If wc is a null wide character, a null byte is stored preceded by
    any shift sequence needed to restore the initial shift state. The
    resulting state described is the initial conversion state.

3  –  Return Values

    n                  The number of bytes stored in the resulting
                       array, including any shift sequences to
                       represent the multibyte character.
    -1                 Indicates an encoding error. The wc argument
                       is not a valid wide character. The global
                       errno is set to EILSEQ; the conversion state
                       is undefined.
Close Help