Basically I am trying to decompress some source to the dynamically allocation memory pointed by data pointer. I have following code, I can see copy()
is working, but data pointed memory is all 0s
. does anyone know why?
void *data = new float[1000000]();
std::ostringstream dest;
dest.rdbuf()->pubsetbuf((char *)data,1000000*4);
boost::iostreams::array_source source( some source );
boost::iostreams::filtering_istreambuf in;
boost::iostreams::filtering_ostreambuf out;
in.push( ios::gzip_decompressor() );
in.push( source );
out.push( dest );
boost::iostreams::copy( in, out );
note here data has to be a void pointer, and I have to use new operator since the data size is changing based on another indicator.
Edit: I found answer here: Setting the internal buffer used by a standard stream (pubsetbuf)