Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extracting compressed file with boost::iostreams

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!

like image 571
Pieter Hoste Avatar asked Dec 30 '22 18:12

Pieter Hoste


2 Answers

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.

like image 163
Jeff Hardy Avatar answered Jan 11 '23 08:01

Jeff Hardy


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.

like image 37
jalf Avatar answered Jan 11 '23 08:01

jalf