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. Unzip a zip file with C++ Qt
Forum Updated to NodeBB v4.3 + New Features

Unzip a zip file with C++ Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.2k 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.
  • T Offline
    T Offline
    tadamo
    wrote on last edited by
    #1

    Hello,

    I want to unzip a zip file protected by a password that I set.
    I retrieved for example Quazip and I found an example of code:

    QuaZip zip("file.zip"); // put real zip file name here
    zip.open(QuaZip::mdUnzip);
    QuaZipFile file(&zip);
    for(bool f=zip.goToFirstFile(); f; f=zip.goToNextFile()) {
        file.open(QIODevice::ReadOnly, "password"); // put real password here
        file.readData(data, maxSize);
        // process data from archive
        file.close();
    }    
    zip.close();
    

    But this example does not work, I have an error in this line:

    file.readData(data, maxSize);
    

    readData seems to be a private member.

    Do you have a simple example to unzip a zip file protected by password, please?

    Thanks.

    JonBJ 1 Reply Last reply
    0
    • T tadamo

      Hello,

      I want to unzip a zip file protected by a password that I set.
      I retrieved for example Quazip and I found an example of code:

      QuaZip zip("file.zip"); // put real zip file name here
      zip.open(QuaZip::mdUnzip);
      QuaZipFile file(&zip);
      for(bool f=zip.goToFirstFile(); f; f=zip.goToNextFile()) {
          file.open(QIODevice::ReadOnly, "password"); // put real password here
          file.readData(data, maxSize);
          // process data from archive
          file.close();
      }    
      zip.close();
      

      But this example does not work, I have an error in this line:

      file.readData(data, maxSize);
      

      readData seems to be a private member.

      Do you have a simple example to unzip a zip file protected by password, please?

      Thanks.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @tadamo
      I don't have an example, and I don't see what relevance password has, but QuaZipFile derives from QIODevice, so aren't you supposed to use methods from that, like read()?

      1 Reply Last reply
      3

      • Login

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