Hi Friends:
I am looking for a piece of code which can: input a .zip file name and provide a
callback facility which allow me walking in file structure, as well as survive
from corrupted zip file.
I had read the example code and test code of zlib part in boost::iostreams, it
extract data like this:
//-- copy from iostreams/filter/test.hpp --//
template
bool test_filter_pair( OutputFilter out,
InputFilter in,
const std::string& data,
mpl::true_ )
{
for ( int inc = default_increment;
inc <= default_increment * 40;
inc += default_increment )
{
array_source src(data.data(), data.data() + data.size());
std::string temp;
std::string dest;
iostreams::copy(src, compose(out, non_blocking_sink(temp, inc)));
iostreams::copy(
compose(in, non_blocking_source(temp, inc)),
iostreams::back_inserter(dest)
);
if (dest != data)
return false;
}
return true;
}
I think it is not gentle because it try catch all data into memory. So there
must be some better way to do?
Rgds, David Xiao