Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. decompress tar.gz
Qt 6.11 is out! See what's new in the release blog

decompress tar.gz

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    s002wjh
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Either use QProcess to call the tar command line tool or use the KArchive library

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • S Offline
        S Offline
        s002wjh
        wrote on last edited by
        #3

        would using system() command work too? so i dont have to do the qprocess

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You can. What is your issue with QProcess ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            s002wjh
            wrote on last edited by s002wjh
            #5

            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.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              No, if tar is properly installed, you can just call it without any special path before it.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              S 1 Reply Last reply
              1
              • SGaistS SGaist

                No, if tar is properly installed, you can just call it without any special path before it.

                S Offline
                S Offline
                s002wjh
                wrote on last edited by s002wjh
                #7

                @SGaist

                so in this case its

                myProcess->start(tar, filepath);?

                also after finish untar does qprocess automatically terminate? or i have to kill it

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  2

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved