id summary reporter owner description type status milestone component version severity resolution keywords cc 3447 After destruction binary_iarchive seeks to the end of file Andrey Upadyshev Robert Ramey "After destruction binary_iarchive seeks to the end of file. This is occured because boost::archive::basic_binary_iprimitive (the ancestor of binary_iarchive) calls std::basic_streambuf::sync in destructor. Calling 'sync' on a file streambuf seeks to the end of file. This is bad, because it lead to skipping of unread input data! I think calling 'sync' is a bad idea (and this call should be removed), but if it is necessary, then the documentation must clearly note that using a file streambuf with binary_iarchive skips to the end of the file. ---- Example: {{{ std::ifstream is( ARCHIVE_FILE_NAME, std::ios::binary ); int i; { boost::archive::binary_iarchive ar( is, boost::archive::no_header ); ar >> i; std::cout << ""Pos after read: "" << is.tellg() << std::endl; } std::cout << ""Pos after dtor: "" << is.tellg() << std::endl; }}} Output: {{{ Pos after read: 4 Pos after dtor: 11 }}} (sizeof(int) is 4, archive file length is 11)" Bugs new serialization Boost 1.39.0 Problem sync file stream basic_binary_iprimitive archive binary_iarchive serialization