Results 1 to 3 of 3

Thread: Lost line with QProcess

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Wink Lost line with QProcess

    I am having problems with the following short program I wrote with Qt 4.1.2

    Qt Code:
    1. #include <QString>
    2. #include <iostream>
    3. #include <QProcess>
    4.  
    5. using namespace std;
    6.  
    7. void ProcessLine( QString );
    8.  
    9. int main()
    10. {
    11. QProcess *gzip = new QProcess;
    12. QString line;
    13. gzip->start("gunzip in.txt.gz -c");
    14.  
    15. while (gzip->waitForReadyRead()) {
    16. while (gzip->canReadLine()) {
    17. line = gzip->readLine();
    18. ProcessLine( line );
    19. }
    20. }
    21. }
    22.  
    23. void ProcessLine( QString line ) {
    24. cout << line.toStdString();
    25. }
    To copy to clipboard, switch view to plain text mode 

    my test file in.txt.gz contains the following all zipped
    this is a test 1
    this is a test 2
    this is a test 3
    this is a test 4
    this is a test 5
    this is a test 6
    this is a test 7
    this is a test 8

    when I compile and run my code I get the following output.
    this is a test 2
    this is a test 3
    this is a test 4
    this is a test 5
    this is a test 6
    this is a test 7
    this is a test 8

    Notice that I have somehow lost the first line of the file.
    every once in a while I do end up getting the first line.

    Can someone Please tell me what's happing to the first line?
    What is wrong with my code?
    Last edited by wysota; 18th May 2006 at 10:37.

Similar Threads

  1. QTcpSocket exception.
    By Fastman in forum Qt Programming
    Replies: 9
    Last Post: 29th January 2008, 13:51
  2. Some very weird compilation warnings
    By MarkoSan in forum Qt Programming
    Replies: 21
    Last Post: 23rd January 2008, 16:48
  3. Qwizard crashed when created in a slot
    By joshlareau in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2008, 09:16
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. QTableView paints too much
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2006, 18:42

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.