Nominate our 2022 Qt Champions!

QuaZip Unzip Trouble

  • 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);;
    QByteArray ba = zFile.readAll();
    QFile dstFile("C:/" + filePath); | QIODevice::Text);

  • Lifetime Qt Champion

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

  • @mrjj

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

    And works like a charm!
    Thank you!

Log in to reply