Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract a tar.xz in C/C++

Tags:

c++

c

tar

qt

xz

I am writing a program that downloads tar.xz files from a server and extracts them in a certain place. I am struggling to find a away of extracting the tar.xz file in the certain place. I am using Qt so a more Qt-way of doing it would be useful, but I don't really mind.

like image 856
Tom Leese Avatar asked Jan 19 '26 08:01

Tom Leese


1 Answers

There is no support for archives in Qt. You can either have a look at the KDE library which offers support for virtual file systems or you can use QProcess to call tar directly. Use -C <dir> (uppercase C) to specify the directory to extract to.

[EDIT] There also is libtar (BSD license).

like image 178
Aaron Digulla Avatar answered Jan 21 '26 21:01

Aaron Digulla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!