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 <tchar.h>
    char *_strinc( const char *current );
    wchar_t *_wcsinc( const wchar_t *current );
    #include <mbstring.h>
    unsigned char *_mbsinc( const unsigned char *current );
    unsigned char *_fmbsinc(
                        const unsigned char __far *current );

Description:
    The _strinc function returns a pointer to the next character
    (single-byte, wide, or multibyte) in the string pointed to by current.
     You must ensure that current does not point into the middle of a
    multibyte or wide character.

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

    The _wcsinc function is a wide-character version of _strinc that
    operates with wide-character strings.

    The _mbsinc function is a multibyte character version of _strinc that
    operates with multibyte character strings.

Returns:
    The _strinc function returns a pointer to the next character
    (single-byte, wide, or multibyte depending on the function used).

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

    const unsigned char chars[] = {
        ' ',
        '.',
        '1',
        'A',
        0x81,0x40, /* double-byte space */
        0x82,0x60, /* double-byte A */
        0x82,0xA6, /* double-byte Hiragana */
        0x83,0x42, /* double-byte Katakana */
        0xA1,      /* single-byte Katakana punctuation */
        0xA6,      /* single-byte Katakana alphabetic */
        0xDF,      /* single-byte Katakana alphabetic */
        0xE0,0xA1, /* double-byte Kanji */
        0x00
    };

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

    void main()
      {
        int                 j, k;
        const unsigned char *next;

        _setmbcp( 932 );
        next = chars;
        do {
          next = _mbsinc( next );
          j = mblen( next, MB_CUR_MAX );
          if( j == 0 ) {
            k = 0;
          } else if ( j == 1 ) {
            k = *next;
          } else if( j == 2 ) {
            k = *(next)<<8 | *(next+1);
          }
          printf( "Next character %#6.4x\n", k );
        } while( next != &chars[ SIZE - 1 ] );
      }

    produces the following:

    Next character 0x002e
    Next character 0x0031
    Next character 0x0041
    Next character 0x8140
    Next character 0x8260
    Next character 0x82a6
    Next character 0x8342
    Next character 0x00a1
    Next character 0x00a6
    Next character 0x00df
    Next character 0xe0a1
    Next character   0000

Classification:
    WATCOM

Systems:
     _strinc - MACRO

    _wcsinc - MACRO
    _mbsinc - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32
    _fmbsinc - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

See Also:
    _strdec, _strninc

See Also:

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