Results 1 to 3 of 3

Thread: Read from a zip file

  1. #1
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Read from a zip file

    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

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Read from a zip file

    Hi Raj!

    I ended up using quazip as well. I just looked it up in my old code - direct reading works like this:

    Qt Code:
    1. QString zipName = QFileDialog::getOpenFileName(this, "Convis DB Import", "", "Zip-File (*.zip)");
    2. QuaZip zip(zipName);
    3. if(!zip.open(QuaZip::mdUnzip))
    4. {Maintenance_PTE->appendPlainText(QString("Import: zip open error: %1").arg(zip.getZipError()));return;}
    5. if (!zip.setCurrentFile("entries.txt"))
    6. {Maintenance_PTE->appendPlainText(QString("Zip entries.txt error: %1").arg(zip.getZipError()));return;}
    7. QuaZipFile inFile(&zip);
    8. if (!inFile.open(QIODevice::ReadOnly)) {Maintenance_PTE->appendPlainText(QString("Import entries error: %1").arg(inFile.getZipError()));return;}
    9. {
    10. QTextStream ts(&inFile);
    11. ...
    12. inFile.close();
    13. }
    14. zip.close();
    To copy to clipboard, switch view to plain text mode 
    HIH

    Joh

  3. The following user says thank you to JohannesMunk for this useful post:

    rajji_saini (21st June 2011)

  4. #3
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Read from a zip file

    Hi Joh,

    Thanks a lot. This will definitely help.

    Regards,
    Raj

Similar Threads

  1. Read from a file
    By matulik in forum Newbie
    Replies: 4
    Last Post: 26th April 2010, 19:02
  2. Read the file into
    By offline in forum Qt Programming
    Replies: 7
    Last Post: 12th April 2010, 12:11
  3. is qt phonon can read realmedia file and divx file
    By fayssalqt in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2009, 15:42
  4. Replies: 1
    Last Post: 20th June 2008, 18:43
  5. Read An Xml File
    By Alienxs in forum Qt Programming
    Replies: 3
    Last Post: 5th January 2007, 00:28

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.