Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QuaZip Unzip Trouble
Forum Update on Monday, May 27th 2025

QuaZip Unzip Trouble

Scheduled Pinned Locked Moved Unsolved General and Desktop
quazip
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Helson
    wrote on 20 Jan 2016, 18:00 last edited by
    #1

    Hello everyone.
    I have the folowing code to unzip a .zip file with some (.exe .txt .pdf)
    But the only file that can be read after unzip is the txt file.
    The others files can't be opened (.pdf .exe) and it file size is wrong

    for (bool more = zip.goToFirstFile(); more; more = zip.goToNextFile()) {
    QString filePath = zip.getCurrentFileName();
    QuaZipFile zFile(zip.getZipName(), filePath);
    zFile.open(QIODevice::ReadOnly);
    QByteArray ba = zFile.readAll();
    zFile.close();
    QFile dstFile("C:/" + filePath);
    dstFile.open(QIODevice::WriteOnly | QIODevice::Text);
    dstFile.write(ba.data());
    dstFile.close();
    }

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 20 Jan 2016, 20:05 last edited by
      #2

      Hi
      Try look for TextStreams and other class that might convert input :)

      H 1 Reply Last reply 20 Jan 2016, 20:08
      1
      • M mrjj
        20 Jan 2016, 20:05

        Hi
        Try look for TextStreams and other class that might convert input :)

        H Offline
        H Offline
        Helson
        wrote on 20 Jan 2016, 20:08 last edited by
        #3

        @mrjj

        Solve the problem loading the data is this way.
        QDataStream out(&dstFile);
        out.writeRawData(ba.data(), ba.size());

        And works like a charm!
        Thank you!

        1 Reply Last reply
        1

        2/3

        20 Jan 2016, 20:05

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved