Results 1 to 6 of 6

Thread: Help on QProcess - Output Read

  1. #1
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Help on QProcess - Output Read

    Hi,

    I am running the below process in my application

    Qt Code:
    1. QProcess *myProcess = new QProcess(this);
    2. myProcess->start("/EXEC/Unlock");
    3. myProcess->waitForFinished();
    4. //qDebug() << "Unlock Output:" << myProcess->readAll();
    5. qDebug() << "Unlock Output:\n" << myProcess->readAllStandardOutput();
    6. QByteArray newData=myProcess->readAllStandardOutput();
    7. qDebug() << "Unlock Output:" << newData;
    To copy to clipboard, switch view to plain text mode 

    But the output i read from the read using all the above methods gives empty string.

    Help me


    In my Process application I will put the below output in console:

    Qt Code:
    1. qDebug() << "FileName Output:" << fileName;
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Qprocess Help - On readallstandardOutput

    Quote Originally Posted by augusbas View Post
    Hi,

    I am running the below process in my application

    Qt Code:
    1. QProcess *myProcess = new QProcess(this);
    2. myProcess->start("/EXEC/Unlock");
    3. myProcess->waitForFinished();
    4. //qDebug() << "Unlock Output:" << myProcess->readAll();
    5. qDebug() << "Unlock Output:\n" << myProcess->readAllStandardOutput();
    6. QByteArray newData=myProcess->readAllStandardOutput();
    7. qDebug() << "Unlock Output:" << newData;
    To copy to clipboard, switch view to plain text mode 

    But the output i read from using all the above methods gives empty string.

    Help me


    In my Process application I will put the below output in console:

    Qt Code:
    1. qDebug() << "FileName Output:" << fileName;
    To copy to clipboard, switch view to plain text mode 

    Anybody please help
    Last edited by augusbas; 24th September 2009 at 05:32.

  3. #3
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Re: Help on QProcess - Output Read

    I think you can read this thread

    http://www.qtcentre.org/forum/f-qt-p...light=QProcess

    He read ping output...

  4. #4
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Re: Help on QProcess - Output Read

    Quote Originally Posted by wirasto View Post
    I think you can read this thread

    http://www.qtcentre.org/forum/f-qt-p...light=QProcess

    He read ping output...
    Hi,

    thanks for reply...

    In my process application, i am trying to put data through qdebug i.e I am printing a QString.

    Whether this is the right way to put standard output data?

    And i am reading the data in my application through readAllStandardOutput() ; But my output is empty string.

    I referred the link send by you, still for me the same output "Empty String"

    need your help

  5. #5
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Help on QProcess - Output Read

    qDebug() puts output on standard error so if you want to read output from qDebug() just read standard error: QProcess::readAllStandardError()
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  6. The following user says thank you to faldzip for this useful post:

    augusbas (24th September 2009)

  7. #6
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Thumbs up Re: Help on QProcess - Output Read

    Quote Originally Posted by faldżip View Post
    qDebug() puts output on standard error so if you want to read output from qDebug() just read standard error: QProcess::readAllStandardError()

    Thanks Buddy.. it worked

Similar Threads

  1. Replies: 7
    Last Post: 8th May 2009, 10:26
  2. How to Compile VTKDesigner2 with Qt?
    By alfredoaal in forum Newbie
    Replies: 0
    Last Post: 5th September 2008, 05:34
  3. Replies: 2
    Last Post: 2nd June 2008, 08:45
  4. QProcess and capturing output
    By Aragorn in forum Qt Programming
    Replies: 7
    Last Post: 3rd May 2007, 16:57
  5. QProcess : child process listening parent output ?
    By Nyphel in forum Qt Programming
    Replies: 16
    Last Post: 20th March 2007, 13:40

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.