Big question guys, is giving me a big headache...How can I deflate a string? I want to send it over a StreamSocket to another computer but I want to compress it. I tried this bit of code and I get an error when copying the deflater stream to another stream. And how can I get the size of the compressed stream???
Another idea is to create an ostream from a string (which I don't know how to do it) and then get the compressed version
Help!
- Code: Select all
ostringstream str;
istringstream outstr(XMLString);
DeflatingStreamBuf deflater(outstr, Poco::DeflatingStreamBuf::STREAM_ZLIB, -1);
deflater<<XMLString;
deflater.close();
StreamCopier::copyStream(str, deflater);
cout <<"Compressed size: "<<outstr.str().size();





