Qt: a simple example for Quazip

I built the quazip library. I need a simple example that shows how to unzip a zip file. For instance.

Quazip zipFile( QFile("test.zip") ); zipFile.unzip(); 

The tests shown in quazip are a bit confusing. I searched for a short time to find an example, and I could not find it.

+6
source share
2 answers

Here is a quick example showing how to read files. You will need to make some changes to the code in a loop to write data to a file or perform any operations that your application will need:

 QuaZip zip("zipFile.zip"); zip.open(QuaZip::mdUnzip); QuaZipFile file(&zip); for(bool f=zip.goToFirstFile(); f; f=zip.goToNextFile()) { file.open(QIODevice::ReadOnly); //same functionality as QIODevice::readData() -- data is a char*, maxSize is qint64 file.readData(data,maxSize); //do something with the data file.close(); } zip.close(); 
+10
source

You can use the static functions of the JlCompress class. It is very easy to use.

Static functions of public users

 static bool compressFile (QString fileCompressed, QString file) static bool compressFiles (QString fileCompressed, QStringList files) static bool compressDir (QString fileCompressed, QString dir=QString(), bool recursive=true) static QString extractFile (QString fileCompressed, QString fileName, QString fileDest=QString()) static QStringList extractFiles (QString fileCompressed, QStringList files, QString dir=QString()) static QStringList extractDir (QString fileCompressed, QString dir=QString()) static QStringList getFileList (QString fileCompressed) 

Source: http://quazip.sourceforge.net/classJlCompress.html

+8
source

Source: https://habr.com/ru/post/913995/


All Articles