Results 1 to 2 of 2

Thread: Read output of QProcess in runtime

  1. #1
    Join Date
    Aug 2012
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Read output of QProcess in runtime

    Hi everyone.

    I'm creating a GUI for a commandl-line linux application and i've finished the "argument wrapping stange"
    Now i have to read the output of the command line app while it is running so i can't use the waitforread or the readytoread signals :S
    my code:

    Qt Code:
    1. proc= new QProcess(this); //proc is global QProcess*
    2. QObject::connect(proc,SIGNAL(readyRead()),this,SLOT(readoutput()));
    3.  
    4.  
    5. proc->start("./asd",args); //args is QStringList*
    6.  
    7. void Widget::readoutput()
    8. {
    9. qDebug() << proc->readStandardOutput();
    10. qDebug() << proc.readStandartError()
    11. }
    To copy to clipboard, switch view to plain text mode 
    but as i said it's not working i have to wait till the process is finished..
    Last edited by silur; 23rd September 2012 at 14:59.

  2. #2
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Read output of QProcess in runtime

    That`s because you connected the wrong signal.
    Read the docs.

Similar Threads

  1. why can't QProcess read all output?
    By Raul in forum Qt Programming
    Replies: 32
    Last Post: 15th June 2013, 12:17
  2. read output data
    By KillGabio in forum General Programming
    Replies: 4
    Last Post: 6th February 2012, 16:31
  3. Can't get QProcess output
    By croscato in forum Qt Programming
    Replies: 6
    Last Post: 18th November 2010, 15:56
  4. Read most recent output from QProcess's stdout
    By Lawand in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2010, 22:29
  5. Help on QProcess - Output Read
    By augusbas in forum Qt Programming
    Replies: 5
    Last Post: 24th September 2009, 11:54

Tags for this Thread

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.