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 Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <wchar.h>
    int wctob( wint_t wc );

Description:
    The wctob function determines whether wc corresponds to a member of the
    extended character set whose multibyte character representation is as a
    single byte when in the initial shift state.

Returns:
    The wctob function returns EOF if wc does not correspond to a multibyte
    character with length one; otherwise, it returns the single byte
    representation.


Example:
    #include <stdio.h>
    #include <wchar.h>
    #include <mbctype.h>

    const wint_t wc[] = {
        0x0020,
        0x002e,
        0x0031,
        0x0041,
        0x3000,     /* double-byte space */
        0xff21,     /* double-byte A */
        0x3048,     /* double-byte Hiragana */
        0x30a3,     /* double-byte Katakana */
        0xff61,     /* single-byte Katakana punctuation */
        0xff66,     /* single-byte Katakana alphabetic */
        0xff9f,     /* single-byte Katakana alphabetic */
        0x720d,     /* double-byte Kanji */
        0x0000
    };

    #define SIZE sizeof( wc ) / sizeof( wchar_t )

    void main()
    {
        int         i, j;

        _setmbcp( 932 );
        for( i = 0; i < SIZE; i++ ) {
          j = wctob( wc[i] );
          if( j == EOF ) {
            printf( "%#6.4x EOF\n", wc[i] );
          } else {
            printf( "%#6.4x->%#6.4x\n", wc[i], j );
          }
        }
    }

    produces the following:

    0x0020->0x0020
    0x002e->0x002e
    0x0031->0x0031
    0x0041->0x0041
    0x3000 EOF
    0xff21 EOF
    0x3048 EOF
    0x30a3 EOF
    0xff61->0x00a1
    0xff66->0x00a6
    0xff9f->0x00df
    0x720d EOF
      0000->0x0000

Classification:
    ANSI

Systems:
    DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

See Also:
    _mbccmp, _mbccpy, _mbcicmp, _mbcjistojms, _mbcjmstojis, _mbclen,
    _mbctohira, _mbctokata, _mbctolower, _mbctombb, _mbctoupper, mblen,
    mbrlen, mbrtowc, mbsrtowcs, mbstowcs, mbtowc, sisinit, wcrtomb,
    wcsrtombs, wcstombs, wctomb

See Also: _mbcjistojms _mbcjmstojis

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