Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    int wctomb( char *s, wchar_t wchar );

Description:
    The wctomb function determines the number of bytes required to represent
    the multibyte character corresponding to the code contained in wchar.
     If s is not a NULL pointer, the multibyte character representation is
    stored in the array pointed to by s.  At most  MB_CUR_MAX characters
    will be stored.

Returns:
    If s is a NULL pointer, the wctomb function returns zero if multibyte
    character encodings do not have state-dependent encoding, and non-zero
    otherwise.  If s is not a NULL pointer, the wctomb function returns:

    -1
        if the value of wchar does not correspond to a valid multibyte
        character

    len
        the number of bytes that comprise the multibyte character
        corresponding to the value of wchar.


See Also:
    mblen, mbstowcs, mbtowc, wcstombs

Example:
    #include <stdio.h>
    #include <stdlib.h>

    wchar_t wchar = { 0x0073 };
    char    mbbuffer[MB_CUR_MAX];

    void main()
      {
        int len;

        printf( "Character encodings do %shave "
                "state-dependent encoding\n",
                ( wctomb( NULL, 0 ) )
                ? "" : "not " );

        len = wctomb( mbbuffer, wchar );
        mbbuffer[len] = '\0';
        printf( "%s(%d)\n", mbbuffer, len );
      }

    produces the following:

    Character encodings do not have state-dependent encoding
    s(1)

Classification:
    ANSI

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson