Scenario:
I am running on an embedded linux distro with a C++ application on it. I need to simply compress a directory and place the zipped output at a certain location. Thats it.
I know that we can tar compress a directory using the following command on a command line interface.
tar cvzf directory.tar.gz /path/to/directory
I see that I have an option to run system commands in C++. Following is a example ot it.
void CompressDirectory() {
std::system("tar cvzf directory.tar.gz /path/to/directory");
}
Environment:
Embedded Linux
Question:
I wish to know the pros and cons of making a system call to tar a directory vs using a library like zlib, zipios etc.