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/mbctoupp.c

35 lines
773 B
C

#include <stdio.h>
#include <mbctype.h>
#include <mbstring.h>
unsigned int chars[] = {
'a', /* single-byte a */
'b', /* single-byte b */
'c', /* single-byte c */
'd', /* single-byte d */
'e', /* single-byte e */
0x8281, /* double-byte a */
0x8282, /* double-byte b */
0x8283, /* double-byte c */
0x8284, /* double-byte d */
0x8285 /* double-byte e */
};
#define SIZE sizeof( chars ) / sizeof( unsigned int )
void main()
{
int i;
unsigned int c;
_setmbcp( 932 );
for( i = 0; i < SIZE; i++ ) {
c = _mbctoupper( chars[ i ] );
if( c > 0xff )
printf( "%c%c", c>>8, c );
else
printf( "%c", c );
}
printf( "\n" );
}