eg writes:
The >> operators work on a character basis... they dont work well on
binary data. Try initializing your string differently and see if you
have better luck (similarly later on in your example).
this code works well...
#include <fstream>
#include <sstream>
#include
//#include
#include
namespace io = boost::iostreams;
int main()
{
using namespace std;
ifstream file("hello.gz", ios_base::in | ios_base::binary);
io::filtering_istream in;
in.push(io::gzip_decompressor());
in.push(file);
//std::ostringstream ostr;
//io::copy (in, ostr);
//std::string stir = ostr.str ();
std::string stir;
in >> stir;
ofstream ofs("output.gz", ios_base::out | ios_base::binary);
io::filtering_ostream out;
out.push (io::gzip_compressor());
out.push (ofs);
out << stir;
}
but I just want to know how to do the same thing from memory?
Can anyone help me please?
Thanks!!!