BOOST.IOstreams: trouble to write to bzip2.

Posted by Arman on Stack Overflow See other posts from Stack Overflow or by Arman
Published on 2010-04-01T08:59:45Z Indexed on 2010/04/01 9:03 UTC
Read the original article Hit count: 645

Filed under:
|
|

Hello I am would like to store my data in to bzip2 file using Boost.IOstreams.

void test_bzip()
{
namespace BI = boost::iostreams;
{
string fname="test.bz2";
  {
    BI::filtering_stream<BI::bidirectional> my_filter; 
    my_filter.push(BI::combine(BI::bzip2_decompressor(), BI::bzip2_compressor())) ; 
    my_filter.push(std::fstream(fname.c_str(), std::ios::binary|std::ios::out)) ; 
    my_filter << "test" ; 

    }//when my_filter is destroyed it is trowing an assertion.
}
};

What I am doing wrong? I am using boost 1.42.0.

kind regards Arman.

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost-iostreams