| 
      wctomb - converts a wide character to a multibyte character
      Standard C Library (libc, -lc)
      #include <stdlib.h>
     int
     wctomb(char * s, const wchar_t wchar);
     The wctomb() converts the wide character wchar to the corresponding
     multibyte character, and store it to the array pointed by s.  The
     wctomb() may store at most MB_CUR_MAX bytes to the array.
     In state-dependent encoding, the wctomb() may store the special sequence
     to change the conversion state before an actual multibyte character into
     the array pointed s.  If wchar is null wide character (L'\0'), this function
 places its own internal state to an initial conversion state.
     Calling any other functions in the Standard C Library (libc, -lc) never
     change the internal state of the wctomb(), except for calling
     setlocale(3) with changing LC_CTYPE category of the current locale.  Such
     setlocale(3) call causes the internal state of this function to be indeterminate.
     The behaviour of the wctomb() is affected by LC_CTYPE category of the
     current locale.
     There is a special case:
     s == NULL     wctomb() initializes its own internal state to an initial
                   state, and determines whether the current encoding is
                   state-dependent.  This function returns 0 if the encoding
                   is state-independent, otherwise non-zero.  In this case,
                   wchar is completely ignored.
     In the usual case, the wctomb() returns:
     positive      number of bytes for the valid multibyte character pointed
                   by s.  There is no cases that the value returned is greater
                   than n or the value of MB_CUR_MAX macro.
     -1            wchar is an invalid wide character.
     In the case that s is equal to NULL, the mbtowc() returns:
     0           The current encoding is state-independent.
     non-zero    The current encoding is state-dependent.
     No errors are defined.
 
     setlocale(3)
     The wctomb() function conforms to ANSI X3.159-1989 (``ANSI C'').
BSD                            February 3, 2002                            BSD
[ Back ] |