Results 1 to 2 of 2

Thread: Can you extract a tarball with Qt?

  1. #1
    Join Date
    Dec 2010
    Posts
    76
    Thanks
    13
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Can you extract a tarball with Qt?

    I was wondering if there was a way to read in a tarball (e.g. file.tar.gz) with Qt? What I would like to be able to do is the user clicks on a tarball and Qt extracts the information, looks for a file in the extracted directory, and loads it without the user having to do anything other then select Open (from the main window) and select the tarball.

    Thanks for any help!

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Can you extract a tarball with Qt?

    C++ can do these things.

    Aside from the obvious basic file manipulation, Qt may be able to help with uncompressing the TAR file, see qUncompress. The expected uncompressed size is the last four bytes of the gzip file. There is no QUnpackATarball class unless you care to write it.

    Edit: It seems from a second reading you would be happy to actually extract the file to a temporary location and then open the relevant file. You can use Qt to launch system commands (QProcess) to do the unpacking and directory traversal (QDir and QFile). This makes your program platform specific though: GNU tar, or gunzip and another tar won't exist on Windows unless you provide them.
    Last edited by ChrisW67; 8th December 2010 at 23:42.

Similar Threads

  1. Qt extract from xml with DOM
    By Leoha_Zveri in forum Qt Programming
    Replies: 0
    Last Post: 4th October 2009, 10:59
  2. QWebView Extract Information
    By tpf80 in forum Qt Programming
    Replies: 2
    Last Post: 23rd October 2008, 01:00
  3. moc-files in tarball
    By roxton in forum Installation and Deployment
    Replies: 4
    Last Post: 24th July 2008, 14:11
  4. extract data from sqlTablemodel
    By peace_comp in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2008, 19:25
  5. How To Extract A File
    By deekayt in forum General Programming
    Replies: 7
    Last Post: 5th December 2006, 18:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.