
Paul Giaccone wrote:
How do you close a filtering_ostream object once you have finished writing to it?
I tried calling out.reset() to the filtering_ostream object. This has the desired effect, as the data is written to file before "out" falls out of scope, but then when the end of the scope is reached, my program crashes in the destructor. If this is not the right way to flush the stream, what should I be doing instead? I tried strict_sync() but this returned false because it looks as though the compressor is not flushable (although I could not find anything about this in the documentation). I am working in Visual Studio .NET 7.1. Call stack:
MyProgram.exe!std::locale::locale(const std::locale & _Right={...}) Line 231 + 0x29 C++ MyProgram.exe!std::basic_streambuf<char,std::char_traits<char> ::pubimbue(const std::locale & _Newlocale={...}) Line 77 + 0xf C++ MyProgram.exe!std::basic_ios<char,std::char_traits<char> ::imbue(const std::locale & _Loc={...}) Line 96 + 0x17 C++
MyProgram.exe!boost::io::basic_ios_locale_saver<char,std::char_traits<char>
::restore() Line 241 + 0x1e C++
MyProgram.exe!boost::io::basic_ios_locale_saver<char,std::char_traits<char>
::~basic_ios_locale_saver<char,std::char_traits<char> >() Line 238 + 0x2b C++
MyProgram.exe!boost::archive::basic_text_oprimitive<std::basic_ostream<char,std::char_traits<char>
::~basic_text_oprimitive<std::basic_ostream<char,std::char_traits<char>
() Line 105 + 0xf C++
MyProgram.exe!boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl<boost::archive::text_oarchive>() Line 72 + 0x80 C++ MyProgram.exe!boost::archive::text_oarchive::~text_oarchive() Line 89 + 0x34 C++ MyProgram.exe!MyClass::save(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & filename={...}) Line 173 + 0x16 C++ Paul Giaccone