Boost logo

Boost Users :

Subject: Re: [Boost-users] bzip2_compressor help
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2010-10-14 15:28:58


>            namespace BI = boost::iostreams;
>            BI::filtering_ostream out;
>            std::fstream mfile("test.gz", std::ios::binary|std::ios::out);
>            out.push(BI::bzip2_compressor());
>            out.push(mfile);
>            out << "This is a gz file" << endl;

Maybe you should replace fstream by BI::file_sink?
but note that the file is closed (and fully written) only when the
variable out is destroyed so that you need to enclose your code in {
... } if you need to use the file just after out <<...<< endl;

Frédéric


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net