16,473
社区成员
发帖
与我相关
我的任务
分享
CString mfcstr(L"hello");
std::wstring str(mfcstr);
#include <afx.h>
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
CString str("寒江雪是一个好人!");
setlocale(LC_ALL,"chs");
#ifdef UNICODE
wstring name=str.GetBuffer();
wcout<<name<<endl;
#else
string word=str.GetBuffer();
cout<<word<<endl;
#endif
string sen("Hero,May god be with you!");
CString csen=sen.c_str();
#ifdef UNICODE
wcout<<csen.GetBuffer()<<endl;
#else
cout<<csen.GetBuffer()<<endl;
#endif
system("pause");
return 0;
}