#include "stdafx.h" #include <afxwin.h> //#include
//#include
#include <iostream> using namespace std; int main( void ) {
CString str( L"%First Second#Third" ); CString resToken; int curPos= 0; resToken= str.Tokenize(L"% #",curPos); while (resToken != L"") { wcout.imbue(locale("chs")); //设置locale
wcout<< resToken << endl; char buf[20]={'\0'}; WideCharToMultiByte(NULL,CP_ACP,resToken,resToken.GetLength(),buf,resToken.GetLength(),NULL,NULL); cout << buf << endl; resToken= str.Tokenize(L"% #",curPos); }; wchar_t text= L'我'; wcout.imbue(locale("chs")); wcout <<"this is "<<text << endl;
return 0; }
|
输出单个中文字符是在网上查的 整个字符串输出光用wcout是不行的 要转成单字节的字符串
代码不想注释了 看结果就OK
00,3A9,B58
First
00,3AF,1E8
Second
00,DF1,5D0
Third
this is 我
阅读(5555) | 评论(0) | 转发(0) |