更新时间:2022-06-26 06:09:28
我在这里使用 Visual Studio 2010 验证了一个解决方案.通过这个 MSDN 文章 和 MSDN 博客文章.诀窍是对 _setmode(..., _O_U16TEXT)
的模糊调用.
I have verified a solution here using Visual Studio 2010. Via this MSDN article and MSDN blog post. The trick is an obscure call to _setmode(..., _O_U16TEXT)
.
解决方案:
#include <iostream>
#include <io.h>
#include <fcntl.h>
int wmain(int argc, wchar_t* argv[])
{
_setmode(_fileno(stdout), _O_U16TEXT);
std::wcout << L"Testing unicode -- English -- Ελληνικά -- Español." << std::endl;
}
截图: