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);
    dstFile.open(QIODevice::WriteOnly | QIODevice::Text);

  • Qt Champions 2017

    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.data(), ba.size());

    And works like a charm!
    Thank you!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.