简体   繁体   English

无法在我的 C++ MFC 应用程序中打印出英文和西里尔文

[英]Can't print out in both english and cyrillic in my C++ MFC application

Im writing a MFC application.我正在编写一个 MFC 应用程序。 I need to use the CString class not something else.我需要使用 CString class 而不是别的。 I've done the following because it was the only way I could display cyrillic.我已经完成了以下操作,因为这是我可以显示西里尔字母的唯一方法。 Without I either got question marks or nothing showed up at all.没有我要么得到问号,要么什么都没有出现。

_setmode(_fileno(stdout), _O_U16TEXT);

So this works:所以这有效:

CString strTestObj2("дададада");
wprintf(L"%s", strTestObj2);

But this doesn't:但这不会:

CString strTestObj1("String1.");
printf("%s", strTestObj1);

It gives a runtime error.它给出了运行时错误。 What can I do to fix it?我能做些什么来修复它?

This was fixed by setting the OS system locale to bulgarian.这已通过将操作系统系统区域设置为保加利亚语来解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM