Question

I'm searching for a way to extract a file in c++ by using the boost::iostreams classes.

There is an example in the boost documentation. But it outputs the content of the compressed file to std::cout. I'm looking for a way to extract it to a file structure.

Does anybody know how to do that?

Thanks!

Was it helpful?

Solution

Boost.IOStreams does not support compressed archives, just single compressed files. If you want to extract a .zip or .tar file to a directory tree, you'll need to use a different library.

OTHER TIPS

The example in the documentation shows how to decompress the file and push the result to another stream.

If you want the output to be directed to an in-memory array instead, you can use a stream of type boost::iostreams::stream<boost::iostreams::array_source>instead.

That is basically a stream-wrapper around an array.

I'm not sure what you mean when you say you want the output in "a file structure" though.

Looks to me like the call to boost::iostreams::copy takes an ostream as the second parameter. Have you tried creating an ofstream with your output file name and using that?

You probably don't want that library. You might want to look around for some others.

E.g. zziplib

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top