开放源码的编译器open watcom 1.6.0版的源代码

源代码在线查看: mbrlen.c

软件大小: 39337 K
上传用户: zhongcheng211
关键词: watcom open 开放源码 编译器
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include 
				#include 
				#include 
				#include 
				
				
				const 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()
				  {
				    int         i, j, k;
				
				    _setmbcp( 932 );
				    j = 1;
				    for( i = 0; j > 0; i += j ) {
				      j = mbrlen( &chars[i], MB_CUR_MAX, NULL );
				      printf( "%d bytes in character ", j );
				      if( errno == EILSEQ ) {
				        printf( " - illegal multibyte character\n" );
				      } else {
				        if( j == 0 ) {
				          k = 0;
				        } else if ( j == 1 ) {
				          k = chars[i];
				        } else if( j == 2 ) {
				          k = chars[i]				        }
				        printf( "(%#6.4x)\n", k );
				      }
				    }
				  }
							

相关资源