Sebastian Korf wrote:
int main() { using namespace std; using namespace boost::iostreams; ifstream file("E:\\test.txt.bz2", ios_base::in | ios_base::binary); filtering_streambuf<input> in; in.push(bzip2_decompressor()); in.push(file); ofstream fileOutput("E:\\test2.text"); copy(in,fileOutput); }
But if i try to decompress a file which i serialized, bzip just runs forever doing nothing.
There are several open tickets which deal with (de-)compression with iostreams. I had problems with zip, bzip and istreams myself. I found that ostreams work where istreams don't: https://svn.boost.org/trac/boost/ticket/2411 Unfortunately, with gzip decompression, ostreams sometimes fail but istreams work: https://svn.boost.org/trac/boost/ticket/2415 An infinite loop also has been reported before (in case of invalid input) https://svn.boost.org/trac/boost/ticket/2783 I also wrote a test program some time ago to determine the best compression method for my purposes, see attachment. HTH Regards, Roland