3

I have a simple application in Qt where the user enters data in a text file, which is then saved on desktop. After that I would like to be able to insert the .txt file in a .zip file.

I have tried to use QuaZIP with no success, it seems too complicated to understand.

Any help or suggestion would be greatly appreciated.

Bart
  • 19,692
  • 7
  • 68
  • 77
croussou
  • 77
  • 1
  • 6

2 Answers2

1

Bugless archive library is pretty good.This is how you would add files to an archive.

bool addFilesToArchive(const QString& archiveName, const QStringList& fileNames, const QString& password )
{
    Archive a;
    a.setArchiveName( archiveName );

    if ( !password.isEmpty() )
    {
        a.setPassword( password );
    }

    return a.addFiles( fileNames );
}

For more checkout the library at http://www.bugless.co.uk/products/archive/archive.html

Gandalf
  • 1
  • 29
  • 94
  • 165
  • The library has dual licensing (GNU GPL plus the Bugless proprietary license).I remember it working when i tried it. – Gandalf Feb 24 '12 at 10:50
0

libkarchive from the KDE frameworks provides exactly this. It's not released as a standalone library yet, though, but you could grab it from kdelibs git, branch frameworks.

Alternatively, the bugless library is an option as well, indeed.

David Faure
  • 1,836
  • 15
  • 19