Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Unzip a zip file with C++ Qt



  • 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.



  • @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()?


Log in to reply