
On Saturday, April 14, 2007 at 02:44:38 (+0200) Aljaz writes:
Here is how you can do the former, when saving:
std::ofstream ofs(file_name); boost::iostreams::filtering_ostream out; boost::iostreams::zlib_params zp(boost::iostreams::zlib::best_speed); out.push(boost::iostreams::zlib_compressor(zp)); out.push(ofs); Archive oa(out); oa << BOOST_SERIALIZATION_NVP(message_request);
Hey
I tried doing
std::stringstream ofs; boost::iostreams::filtering_ostream out; boost::iostreams::zlib_params zp(boost::iostreams::zlib::best_speed); out.push(boost::iostreams::zlib_compressor(zp)); out.push(ofs); ofs << "some test";
but it seems like it doesnt work when I run the program the size of ofs.str().size() is 0.
What am I doing wrong?
Well, for one, using a broken c++ library, apparently. If you do stringstream ofs; ofs << "some test"; then, none of the other stuff you did makes any difference. If you can't get the above to work, you're in big trouble. Here is a program that works: #include <sstream> #include <iostream> using namespace std; int main() { stringstream ofs; ofs << "some test"; cout << ofs.str().size() << endl; } Bill