MSVC2019 ifstream 不可用

问题描述

不是一个真正的问题,而是一个提示:MS 版本的 STL 中的流几乎无法使用,除了最基本的任务。

我基本上一直在尝试执行以下操作(使用 ifstream 的实例作为实际参数):

void test(std::istream& is)
{
   auto pos1 = is.tellg();
   is.read(some_buffer,some_size);
   auto pos2 = is.tellg();
   assert(is.gcount() == some_size);
   assert(pos2 == pos1 + is.gcount());   // fails intermittently,with a difference of 1 byte!
}

代码在 GCC 中没有问题!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)