#include <QtCore/QCoreApplication> #include <QTextStream> #include <QXmlStreamReader> #include <QtXML/QDom.h> #include <QZip/QuaZipFile.h> #include <iostream> int main(int argc,char *argv[]) { QCoreApplication app(argc,argv); QuaZip zip(":qrc/zip.zip"); if(!zip.open(QuaZip::mdUnzip)) { std::cout<<"open failed:"<<zip.getZipError()<<std::endl; system("pause"); return -1; } if(zip.setCurrentFile("list.xml")) { QuaZipFile zipfile(&zip); if(!zipfile.open(QIODevice::ReadOnly)) { std::cout<<"open zipfile failed"<<std::endl; system("pause"); return -1; } QTextStream stream(&zipfile); while(!stream.atEnd()) std::cout<<qPrintable(stream.readLine())<<std::endl; zipfile.close(); zip.close(); } else std::cout<<"set current file failed."<<std::endl; system("pause"); return 1; }
需要使用QuaZip库