Unsolved decompress tar.gz
-
how do i decompress a file
QTemporaryFile* file = some input file i got it
QString myFile =/home/test/xx.tar.gz;file->copy(myFile);
i want extract file into myFile path
-
Hi,
Either use QProcess to call the tar command line tool or use the KArchive library
-
would using system() command work too? so i dont have to do the qprocess
-
You can. What is your issue with QProcess ?
-
well i have some trouble find the "tar" program, i remember qprocess is like this
myProcess->start(program, arguments);
arguments=path of tar.gz
program =path of tar program which i have no idea where is at under my linux.also if i run on another linux not sure tar app gonna be at same location.
-
No, if tar is properly installed, you can just call it without any special path before it.
-
so in this case its
myProcess->start(tar, filepath);?
also after finish untar does qprocess automatically terminate? or i have to kill it
-
If you want tar to do something you have to pass it arguments, not just the archive name.
If you take a look at the documentation I linked to, you'll see how to build the argument list to pass as second argument to the start method.