1. Introduction
The Quazip is an open-source library for compressing zip and extracting zip using the qt,c++ zlib for simple encapsulation. If you use compression and unzip zip in your QT project, you might consider using it.
Official homepage: http://quazip.sourceforge.net/
Souceforge Download Address: http://sourceforge.net/projects/quazip/
2. Compiling
Quazip is based on the Zlib library, before compiling to import zlib header file, compiled will generate Quazip.lib and Quazip.dll files (with VS)
If using QT to compile, the direct compilation will be error, need to add zlib.h containing directory, in the Quazip/quazip.pro file add Includepath + = "qt Source directory \src\qtbase\src\3rdparty\zlib"
Subdirs = Quazip qztest comments in the Quazip.pro file are also replaced with subdirs = Quazip, and selecting rebuild will generate LIBQUAZIPD.A and Quazipd.dll
3. Application
Add the directory where the Quazip.lib is located in your new project to the project.
Compress and decompress files with the Jlcompress class in Quazip
static method Compressed File
static bool Compressdir (QString filecompressed, QString dir=qstring (), bool recursive = TRUE)
The first parameter, filecompressed, represents a compressed file
The second parameter, dir, indicates the directory to be compressed
The third parameter, recursive, indicates whether recursion
static method for decompression: Extractdir
Static Qstringlist Extractdir (QString filecompressed, QString dir=qstring ())
The first parameter, filecompressed, represents the file to be decompressed
The second parameter represents the directory where the decompression resides
Here is an example of the program code:
#include <QCoreApplication>
#include "JlCompress.h"
int main (int argc, char *argv[])
{
Qcoreapplication A (argc, argv);
Jlcompress::compressdir ("D:\\test.zip", "d:\\test"); Compress
jlcompress::extractdir ("D:\\test.zip", "d:\\test");//Unzip
return a.exec ();
}