#include#include int main() { // Create a new ZIP archive cpparchive::ZipArchive archive("example.zip"); // Add a file to the archive archive.addFile("file.txt", boost::filesystem::path("path/to/file.txt")); return 0; }
#includeint main() { // Open the TAR archive cpparchive::TarArchive archive("example.tar"); // Extract all files from the archive archive.extractAll(/* target directory */ "/path/to/destination"); return 0; }
#includeThis code creates a new GZIP archive named "example.tar.gz" and adds a directory located at "/path/to/directory" to it. Package library: Boost.int main() { // Create a new GZIP archive cpparchive::GzipArchive archive("example.tar.gz"); // Add a directory to the archive archive.addDirectory(boost::filesystem::path("/path/to/directory")); return 0; }