Results 1 to 20 of 41

Thread: how to unzip the file in qt using gzip

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default how to unzip the file in qt using gzip

    am having zip file in server while i downloading i have to unzip the file using qt..still i dont get proper solution for this
    qt experts can any one give me suggestion for this
    Tahnks in advance

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: how to unzip the file in qt using gzip

    Use QProcess to run gunzip.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to unzip the file in qt using gzip

    Or use KArchive http://inqlude.org/libraries/karchive.html

    Cheers,
    _

  4. The following user says thank you to anda_skoa for this useful post:

    iswaryasenthilkumar (23rd March 2015)

  5. #4
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to unzip the file in qt using gzip

    can you give some examples plss.
    Quote Originally Posted by jthomps View Post
    Use QProcess to run gunzip.
    i have to unzip the files using gzip..
    Quote Originally Posted by anda_skoa View Post

  6. #5
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: how to unzip the file in qt using gzip

    Quote Originally Posted by iswaryasenthilkumar View Post
    can you give some examples plss.
    Not until you have read the docs for QProcess and attempted to implement.

  7. #6
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to unzip the file in qt using gzip

    i read and implemented in my code bt i dont get any result from my code
    Quote Originally Posted by jthomps View Post
    Not until you have read the docs for QProcess and attempted to implement.

  8. #7
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: how to unzip the file in qt using gzip

    Did the QProcess start/run?
    Did you connect the started(), finished(), and error() signals? Did any of the signals fire?
    What was the exit code and exit status for your QProcess?

    Answer these questions and post some code using [code][/code] tags please.

  9. #8
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to unzip the file in qt using gzip

    this was my code
    Qt Code:
    1. #include "widget.h"
    2. #include "ui_widget.h"
    3. #include<QtGui>
    4.  
    5. Widget::Widget(QWidget *parent) :
    6. QWidget(parent),
    7. ui(new Ui::Widget)
    8. {
    9.  
    10. QString program = "/home/digital_images/Desktop/zipfile.zip.gz";//path to zip file
    11. QStringList arguments;
    12. myProcess = new QProcess(this);
    13. connect (myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(printOut()));
    14. connect (myProcess, SIGNAL(readyReadStandardError()), this, SLOT(printError()));
    15. myProcess->start(program, arguments);
    16. myProcess->waitForFinished();
    17. ui->setupUi(this);
    18. }
    19.  
    20. Widget::~Widget()
    21. {
    22. delete ui;
    23. }
    24. void Widget::printOut()
    25. {
    26. QByteArray byteArray = myProcess->readAllStandardOutput();
    27. QStringList strLines = QString(byteArray).split("\n");
    28.  
    29. foreach (QString line, strLines)
    30. {
    31. qDebug()<<line<<"Outputline";
    32. }
    33.  
    34. }
    35. void Widget::printError()
    36. {
    37. QByteArray byteArray = myProcess->readAllStandardError();
    38. QStringList strLines = QString(byteArray).split("\n");
    39.  
    40. foreach (QString line, strLines)
    41. {
    42. qDebug()<<"Errorline"<<line;
    43. }
    44. }
    To copy to clipboard, switch view to plain text mode 
    what am doing wrong please guide me
    Quote Originally Posted by jthomps View Post
    Did the QProcess start/run?
    Did you connect the started(), finished(), and error() signals? Did any of the signals fire?
    What was the exit code and exit status for your QProcess?

    Answer these questions and post some code using [code][/code] tags please.

  10. #9
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: how to unzip the file in qt using gzip

    First, you are setting the program to the zip file. Aren't you attempting to run program gunzip instead? The file name of your zip file should be one of the arguments you pass to the gunzip program.

    What is the return code from waitForFinished? If you are not going to use the started, finished, and error signals, then you should also waitForStarted() after you start the QProcess and check its return code as well.

    Edit: The waitFor* methods will block until they either timeout or the condition is satisfied, so if you are doing this from your GUI thread, your GUI will freeze, which is why I recommend you use the started, finished, and error signals instead.
    Last edited by jefftee; 24th March 2015 at 05:29.

  11. The following user says thank you to jefftee for this useful post:

    iswaryasenthilkumar (24th March 2015)

Similar Threads

  1. unzip zip file contains files and folders with quazip
    By nhocjerry in forum Qt Programming
    Replies: 1
    Last Post: 7th November 2013, 08:19
  2. Need simple example with OSDaB-Zip unzip file
    By noborder in forum Newbie
    Replies: 2
    Last Post: 17th January 2013, 21:59
  3. unZip via 7z.
    By noborder in forum Newbie
    Replies: 9
    Last Post: 23rd December 2012, 19:26
  4. How to Zip/Unzip with QT for symbian???
    By baka3k in forum Newbie
    Replies: 2
    Last Post: 22nd June 2011, 08:24
  5. OpenOffice file to QTextEdit (Unzip Problem)
    By patrik08 in forum Qt Programming
    Replies: 6
    Last Post: 27th November 2006, 10:32

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.