Results 1 to 1 of 1

Thread: SOLVED Linux, Capture output of program in console app

  1. #1
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default SOLVED Linux, Capture output of program in console app

    Hi,
    I'm starting of with QT and linux again after some years.
    I want to write a little console app that starts another program and captures it's output.
    After asking my question (the famous afterPostForumQuestionEvent) I figured it out:

    int main(int argc, char *argv[])
    {
    ByteArray a;
    QProcess p;
    p.setProcessChannelMode(QProcess::MergedChannels);
    p.start("astrolog b n z1 R -c 14");
    p.waitForFinished(-1);
    a = p.readAllStandardOutput();
    qDebug() << a;
    return 0;
    }



    Thanks. Jean.
    Last edited by JeanC; 12th February 2011 at 10:43.

Similar Threads

  1. console output on windows and ubuntu
    By hannesvdc in forum Qt Programming
    Replies: 2
    Last Post: 11th December 2010, 22:43
  2. running external console program by gui program
    By alireza.mixedreality in forum Qt Programming
    Replies: 4
    Last Post: 24th April 2010, 18:05
  3. No output to console
    By Morea in forum Newbie
    Replies: 6
    Last Post: 1st November 2007, 22:51
  4. Replies: 52
    Last Post: 10th December 2006, 14:32
  5. No console output in Mac OSX using Qt4
    By popoholic in forum Qt Programming
    Replies: 2
    Last Post: 26th September 2006, 01:36

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.