读书人

从文件读入中文字符到宽字符数组,该怎

发布时间: 2012-02-14 19:19:19 作者: rapoo

从文件读入中文字符到宽字符数组
void main()
{
wchar_t ch1=L '哀 ';
if(ch1==L '哀 ') //////////////////////true

wchar_t ch2[5];
ifstream ifile( "1.txt ",ios::in); //1.txt中只有一个中文字符 '哀 '。
if(!ifile){cout < < "can not open ";return 0;}
while(ifile.good())
{
ifile.getline((char*)ch,10, ' ');
if(ch[0]==L '哀 ') ///false
if(ch[0]==0xb7a9) ///true
}
}

我想要把中文字符直接读到宽字符数组里,就像手动附值ch2[]={L '哀 '},使ch[0]==L '哀 ' 为true
请问该怎么办??

[解决办法]
帮顶,接分

读书人网 >C语言

热点推荐