I need to unzip a file while running a C++ program (as described in Waiting for unzip to finish before carrying on C++ code on a RedHat machine)
To do this I currently d
You can use plain zlib, or the boost::iostream
gzip facility.
System isn't wrong per se, but you could also write a replacement for it which doesn't use the shell with fork
, exec
, wait
and mkstemp
. This is cumbersome though. Using boost::gzip_decompressor
is the best C++ option to me if you decompress single files. Forking and friends may be better if you need to unzip a directory. Be sure to read about mkstemp
.
For a crash course on fork and exec family: http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html
For an example of using wait
for your child to terminate: http://support.sas.com/documentation/onlinedoc/sasc/doc/lr2/wait.htm
For reference about creating a temporary directory: http://www.gnu.org/s/hello/manual/libc/Temporary-Files.html