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 <mbstring.h>
    int _mbterm( const unsigned char *ch );
    int _fmbterm( const unsigned char __far *ch );

Description:
    The _mbterm function determines if the next multibyte character in the
    string pointed to by ch is a null character or a valid lead byte
    followed by a null character.

    The function is a data model independent form of the _mbterm function
    that accepts far pointer arguments.  It is most useful in mixed memory
    model applications.

Returns:
    The _mbterm function returns 1 if the multibyte character pointed to by
    ch is a null character.  The _mbterm function returns 2 if the multibyte
    character pointed to by ch is a valid lead byte character followed by a
    null character.  Otherwise, the _mbterm function returns 0.


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

    const unsigned char chars[] = {
        ' ',
        '.',
        '1',
        'A',
        0x81,0x40, /* double-byte space */
        0x82,0x00  /* invalid double-byte */
    };

    #define SIZE sizeof( chars ) / sizeof( unsigned char )

    void main()
      {
        int     i, j, k;

        _setmbcp( 932 );
        k = 0;
        for( i = 0; i < SIZE; i++ ) {
          printf( "0x%2.2x %d\n", chars[i],
                  _mbterm( &chars[i] ) );
        }
      }

    produces the following:

    0x20 0
    0x2e 0
    0x31 0
    0x41 0
    0x81 0
    0x40 0
    0x82 2
    0x00 1

Classification:
    WATCOM

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

    _fmbterm - 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, wctob, wctomb

See Also: _mbcjistojms _mbcjmstojis

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