https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64064

LIU Hao <lh_mouse at 126 dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lh_mouse at 126 dot com

--- Comment #1 from LIU Hao <lh_mouse at 126 dot com> ---
AFAICT the only issue here is that one can't pass the result of `pubseekoff()`
back to `pubseekpos()`. Both MSVCRT GCC and UCRT GCC are affected, but MSVC
isn't.


```
#include <fstream>
#include <iostream>

int main(int, char* argv[])
{
  using traits   = std::filebuf::traits_type;
  using int_type = std::filebuf::int_type;

  std::filebuf fb;
  fb.open(argv[1], std::ios::in);

  int_type c;
  while (!traits::eq_int_type(c = fb.sbumpc(), traits::eof()))
  {
    std::cout << static_cast<char>(c);
    auto pos = fb.pubseekoff(0, std::ios::cur, std::ios::in);
    fb.pubseekpos(pos, std::ios::in);
  }

  std::cout << '\n';
}
```

This outputs
```
hl
ol
```

Reply via email to