首页 > 解决方案 > c ++ wcout停止输出,wofstream在一些调用后也停止输出

问题描述

我试图将内容输出到文件

  std::locale::global(std::locale());
  std::wofstream file(outfilename , std::wofstream::binary);

  for (const auto & j : grid[0]) {
      try {
          std::wcout << L"String in WideString " << decoder->decode(j) << std::endl;
          file << decoder->decode(j) << std::endl;
      }
      catch (std::exception& e) {
          std::cout << e.what() << std::endl;
      }

  }

wcout 停止输出任何东西(即使是“WideString 中的字符串”也没有输出),经过一定次数的调用,

(我对其进行了调试,它在停止输出文本后像预期的那样执行 wcout)

wofstream 也会在相同数量的调用后停止输出。

这是我第一次使用widestrings、streams 和couts。

感谢您查看这个。

标签: c++wofstream

解决方案


这是€符号,它阻止 wcout 和 wofstream 工作,从输入文件中删除它,我从中获取数据,使一切按预期工作,非常奇怪


推荐阅读