如何为所有语言打印std :: system_error what()

时间:2019-04-28 12:25:08

标签: c++ windows-console

从Windows控制台应用程序打印what()时,它可以用英语运行,但以韩文运行,例如,输出都是类似以下的问号:

"?????? ???????????????."

下面的代码是我尝试过的。

#include <iostream>
#include <windows.h>

int wmain(void)
{
  try
  {
    throw std::system_error(ERROR_ACCESS_DENIED, std::system_category());
  }

  catch (const std::system_error &e)
  {
    std::wcout << e.what() << std::endl;
  }

  return(0);
}

0 个答案:

没有答案