This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/mbsnbcpy.c

37 lines
882 B
C

#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
};
void main()
{
unsigned char chars2[20];
int i;
_setmbcp( 932 );
_mbsnset( chars2, 0xFF, 20 );
_mbsnbcpy( chars2, chars, 11 );
for( i = 0; i < 20; i++ )
printf( "%2.2x ", chars2[i] );
printf( "\n" );
_mbsnbcpy( chars2, chars, 20 );
for( i = 0; i < 20; i++ )
printf( "%2.2x ", chars2[i] );
printf( "\n" );
}