There is an excellent libarchive library that supports access to several archive formats using a compatible API. You can follow these examples on how to use it.
If you are running Ubuntu, you can easily install this library using the sudo apt-get install libarchive-dev . On other platforms, you may need to download the source code and compile this library yourself.
One of the benefits of using libarchive vs. using system() calls is independent of system utilities, and should also work faster because it is not fork.
source share