int main()
{
string message = "this is a test message!";
cout << "message: " << message << endl;
string compressed;
boost::iostreams::filtering_streambuf<boost::iostreams::output> out;
out.push(boost::iostreams::zlib_compressor());
out.push(boost::iostreams::back_inserter(compressed));
boost::iostreams::copy(boost::make_iterator_range(message), out);
cout << "compressed message: " << compressed << endl;
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
in.push(boost::iostreams::zlib_decompressor());
in.push(boost::make_iterator_range(compressed));
string decompressed;
boost::iostreams::copy(in,
boost::iostreams::back_inserter(decompressed));
cout << "decompressed message: " << decompressed << endl;
}
# g++ zlib.cpp zlib_test2.cpp -o zlib_test2 -lz
# ./zlib_test2
message: this is a test message!
compressed message:
terminate called after throwing an instance of
'boost::iostreams::zlib_error'
what(): zlib error
Aborted
#
Thanks!
Christina
--
View this message in context: http://www.nabble.com/boost-zlib-problem-on-linux-%28works-fine-on-windows%29-tp25530835p25530835.html
Sent from the Boost - Users mailing list archive at Nabble.com.
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Try calling flush on the streambuf.
In Christ,
Steven Watanabe