Visual Studio C ++ console print CString
// the absence of Chinese
CString str1 = _T("hello world.");
wprintf(_T("%s\r\n"), str1.GetBuffer()); str1.ReleaseBuffer();
wcout << str1.GetBuffer() << endl; str1.ReleaseBuffer();
wcout << str1.GetString() << endl;
wcout << (LPCTSTR)str1 << endl;
world the Hello.
the Hello world.
the Hello world.
the Hello world.
Press any key to continue...
//含中文的情况下
wcout.imbue(std::locale("chs"));
CString str1 = _T("hello world. 含中文的情况下");
wprintf(_T("%s\r\n"), str1.GetBuffer()); str1.ReleaseBuffer();
wcout << str1.GetBuffer() << endl; str1.ReleaseBuffer();
wcout << str1.GetString() << endl;
wcout << (LPCTSTR)str1 << endl;
hello world. ???????
hello world. case with the Chinese
hello world. case with the Chinese
hello world. case with the Chinese
press any key to continue...