我有以下的C++代码
char* locale = setlocale(LC_ALL, "German"); // Get the CRT's current locale.
std::locale lollocale(locale);
setlocale(LC_ALL, locale); // Restore the CRT.
wcout.imbue(lollocale); // Now set the std::wcout to have the locale that we got from the CRT.
COORD cur = { 0, 0 };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), cur);
wcout << L"Enemy " << this->enemyStrengthLeft << L"/" << this->enemyStrength << endl;
wcout << L"◄";
for (int i = 0; i < 20; i++) {
if (i % 2 == 0)
wcout << L"■";
else
wcout << L" ";
}
wcout << L"►" << endl;
当我执行它时,Unicode字符不在cmd窗口中显示,我该怎么办?
编辑:
我使用的字体是Lucida Console。
第二次编辑:
如果有帮助的话,我正在运行Windows 7 Enterprise SP1 64位下的Visual Studio 2013 Express for Desktop。
_setmode(_fileno(stdout), _O_WTEXT);
。 - Cubbiboost::nowide
吗?在 Windows 下它可以让一些事情变得不那么糟糕。 - Rook