Jabin Reinhold wrote:
My issue is that at the end of the code, test1.xml(~10k) and test2.xml(~12k) are not identical. Test2.xml has some extraneous characters added to the end (~2k worth). I assume these are leftovers from a memcopy somewhere, but I’m not sure why. I have the same effect when I use zlib_compressor as well. What is wrong with my usage of the library(s)?
if(true) { //Scope used to ensure that the archive is fully processed std::ofstream file("c:\\test.gz", std::ios_base::out | std::ios_base::binary);
Should that be a iostreams::file_sink?
boost::iostreams::filtering_streambufboost::iostreams::output outStream; outStream.push(boost::iostreams::gzip_compressor()); outStream.push(file); boost::iostreams::copy(sStream, outStream); }
Try this: boost::iostreams::filtering_streambufboost::iostreams::output > outStream; outStream.push(boost::iostreams::gzip_compressor()); outStream.push(boost::iostreams::file_sink("c:\\test.gz", std::ios::binary)); boost::iostreams::copy(sStream, outStream);