Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QuaZip Unzip Trouble
Qt 6.12 LTS is out! See what's new in the release blog

QuaZip Unzip Trouble

Scheduled Pinned Locked Moved Unsolved General and Desktop
quazip
3 Posts 2 Posters 2.3k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on 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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      ? 1 Reply Last reply
      0
      • mrjjM mrjj

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

        ? Offline
        ? Offline
        A Former User
        wrote on 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

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved