id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 8572,iosteams indirect_streambuf::init_put_area should seek if data has been read from the get buffer,Alan Birtles ,Jonathan Turkanis,"The following code with std::fstream prints 0x1801 but with boost::iostream prints 0x2000: {{{ boost::iostreams::stream< boost::iostreams::file > ios( boost::iostreams::file( ""test.dat"", std::ios_base::binary | std::ios_base::in | std::ios_base::out | std::ios_base::trunc ), 0x800 ); //std::fstream ios( ""test.dat"", std::ios_base::binary | std::ios_base::in | std::ios_base::out | std::ios_base::trunc ); char buffer[ 0x2000 ]; ios.write( buffer, 0x2000 ); ios.seekg( -0x1000, std::ios_base::cur ); ios.get(); ios.write( buffer, 0x800 ); std::cout << std::hex << ios.tellp() << std::endl; std::cout << std::hex << ios.tellg() << std::endl; }}} I believe the problem lies in indirect_streambuf::init_put_area. The current implementation is: {{{ if (shared_buffer() && gptr() != 0) setg(0, 0, 0); if (output_buffered()) setp(out().begin(), out().end()); else setp(0, 0); }}} I think it should be: {{{ if (shared_buffer() && gptr() != 0) { obj().seek(gptr()-egptr(), BOOST_IOS::cur, BOOST_IOS::in, next_); setg(0, 0, 0); } if (output_buffered()) setp(out().begin(), out().end()); else setp(0, 0); }}} ",Bugs,new,To Be Determined,iostreams,Boost 1.53.0,Problem,,,