I'm using boost
's gzip_compressor
and 'gzip_decompressor' for compressing some string.
I'm compressing string like this
string compressedString;
{
filtering_ostream out;
out.push(gzip_compressor(gzip_params(gzip::best_compression)));
out.push(boost::iostreams::back_inserter(compressedString));
out.write(stringToBeCompressed.c_str(), stringToBeCompressed.size());
}
It works fine, but I can't to decompress it. Here is my code
std::string decompressedString;
{
filtering_ostream out;
out.push(gzip_decompressor());
out.push(boost::iostreams::back_inserter(decompressedString));
out.write(compressedString.c_str(), compressedString.size());
}
What am I doing wrong?
Thank you in advance!