
Ken --
Much thanks for your response.
I DID try that very syntax -- but in that case NOTHING wound up in the file -- it was empty. I think I also tried to flush the ostream -- but that didn't work.
There seems to be some magic here I am missing -- or maybe it's a problem with the GNU 4.0 G++ compiler/libraries, or an Apple / Mac OS specific implementation issue...
Stephen
On Jul 25, 2013, at 11:10 PM, "Ken Appleby"
Try:
std::ofstream myFile("hello.z", std::ios_base::out | std::ios_base::binary); boost::iostreams::filtering_streambufboost::iostreams::output out; out.push(boost::iostreams::zlib_compressor()); out.push(myFile);
std::ostream os(&out); os << "text I want to be compressed and end up in the file..."
On input it would be something like:
std::ifstream myFile( "hello.z", std::ios::in | std::ios::binary ); boost::iostreams::filtering_streambuf< boost::iostreams::input > in; in.push( boost::iostreams::gzip_decompressor() ); in.push( ifs ); std::istream is( &in ); is >> text;
Ken Appleby
Soft Optics Ltd