Posted By

shadevampire on 06/09/11


Tagged

file compress Qt


Versions (?)

Compress a file in pure Qt with qCompress


 / Published in: C++
 

URL: http://lists.trolltech.com/qt-interest/2006-07/thread00070-1.html

decompress can be made similarly. Qt compression cannot handle folders, you have to manage this.

  1. /* compress files */
  2. QFile inFile("test.txt");
  3. inFile.open(QIODevice::ReadOnly);
  4. QByteArray ba = inFile.readAll();
  5.  
  6. QFile file("test.gz");
  7. file.open(QIODevice::WriteOnly);
  8. QDataStream out(&file);
  9. out << qCompress(ba);

Report this snippet  

You need to login to post a comment.