14 Oct
2010
14 Oct
'10
7:28 p.m.
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