View Full Version : Read from a zip file
rajji_saini
21st June 2011, 00:26
Hi,
I want to be able to read from a zip file directly.
On doing some research I found something called QuaZIP @ http://quazip.sourceforge.net/
Is there something directly provided by Qt. Or any guidance on how can it be done ??
Regards,
Raj
JohannesMunk
21st June 2011, 00:34
Hi Raj!
I ended up using quazip as well. I just looked it up in my old code - direct reading works like this:
QString zipName = QFileDialog::getOpenFileName(this, "Convis DB Import", "", "Zip-File (*.zip)");
QuaZip zip(zipName);
if(!zip.open(QuaZip::mdUnzip))
{Maintenance_PTE->appendPlainText(QString("Import: zip open error: %1").arg(zip.getZipError()));return;}
if (!zip.setCurrentFile("entries.txt"))
{Maintenance_PTE->appendPlainText(QString("Zip entries.txt error: %1").arg(zip.getZipError()));return;}
QuaZipFile inFile(&zip);
if (!inFile.open(QIODevice::ReadOnly)) {Maintenance_PTE->appendPlainText(QString("Import entries error: %1").arg(inFile.getZipError()));return;}
{
QTextStream ts(&inFile);
...
inFile.close();
}
zip.close();
HIH
Joh
rajji_saini
21st June 2011, 01:28
Hi Joh,
Thanks a lot. This will definitely help.
Regards,
Raj
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.