Help using KArchive with GZIP files

David Hurka david.hurka at mailbox.org
Tue Nov 3 17:16:08 GMT 2020


> The first question " I have tried to do this but there some error that block
> me to open a file. I dont know if i am using correctly the class
> KCompressionDevice." is related with the code down bellow.
> 
> auto kgzip = KCompressionDevice(
> QUrl(where.toString() + “/” + fileName + “.gz”).toLocalFile(),
> KCompressionDevice::GZip);
> assert(kgzip.isOpen() == true);
> 
> kgzip.write(QString("hello World").toUtf8());
> kgzip.close();

This is probably caused by some auto-correction feature when you pasted your 
code in the email editor, but:

You use both english typographical quotes (“”) and ascii quotes ("). 
Theoretically your compiler should warn about this, otherwise the code will 
behave in some strange way.





More information about the kde-devel mailing list