Paul Giaccone wrote:
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.
Could you post the program (or a simplified version)? When I add reset() to the program in your previous message, it works fine.
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).
Right, the compressors are not flushable. The purpose of strict_sync() is to allow you to switch filters in the middle of a sequence of i/o operations. With compression, switching filters before all the data is compressed will generally result in garbage, so there's no point trying to implement flush().
Paul Giaccone
-- Jonathan Turkanis www.kangaroologic.com