Results 1 to 20 of 33

Thread: why can't QProcess read all output?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Posts
    42

    Default Re: why can't QProcess read all output?

    Quote Originally Posted by Zlatomir View Post
    In C you can use:
    Qt Code:
    1. printf(...);
    2. fflush(stdout);
    To copy to clipboard, switch view to plain text mode 
    to flush the stdout buffer
    if like the following ?
    void mainWindow::iupdateTextEdit()
    {
    QByteArray newData=inprocess.readAllStandardOutput();
    QString text=textEdit->toPlainText()+QString::fromLocal8Bit(newData);
    textEdit->setPlainText(text);
    fflush(stdout);
    }

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: why can't QProcess read all output?

    No, don't use that in Qt.

    Use that in your C application (if you have the source of the C application)

  3. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: why can't QProcess read all output?

    If you run your C program from a dos command line, do you get all output?

  4. #4
    Join Date
    May 2010
    Posts
    42

    Default Re: why can't QProcess read all output?

    Quote Originally Posted by fatjuicymole View Post
    If you run your C program from a dos command line, do you get all output?
    If i set the Konsole to super Konsole(su -) ,i can get all output.but if i set it to "/bin/bash",it can't .

  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: why can't QProcess read all output?

    Quote Originally Posted by Raul View Post
    If i set the Konsole to super Konsole(su -) ,i can get all output.but if i set it to "/bin/bash",it can't .
    Then it seems like you can't get the same behaviour from your Qt app without first requesting su?

  6. #6
    Join Date
    May 2010
    Posts
    42

    Default Re: why can't QProcess read all output?

    Quote Originally Posted by fatjuicymole View Post
    Then it seems like you can't get the same behaviour from your Qt app without first requesting su?
    I just use QProcess start the program.and read the process.I didn't know how to request su first.if you can tell me how to request su first.
    Last edited by Raul; 6th June 2010 at 12:50.

  7. #7
    Join Date
    May 2010
    Posts
    42

    Default Re: why can't QProcess read all output?

    Quote Originally Posted by fatjuicymole View Post
    Then it seems like you can't get the same behaviour from your Qt app without first requesting su?
    I think my problem occurs without first requesting su.and i have studied the PAM.but i can't solve my problem yet,the main reason is that i don't know how to request su first.
    Last edited by Raul; 6th June 2010 at 19:25.

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: why can't QProcess read all output?

    Well, you can always give root access to your program permanently, if you don't want to request it whilst running:

    chown root your_app
    chmod a+xs your_app

  9. #9
    Join Date
    May 2010
    Posts
    42

    Default Re: why can't QProcess read all output?

    Quote Originally Posted by fatjuicymole View Post
    Well, you can always give root access to your program permanently, if you don't want to request it whilst running:

    chown root your_app
    chmod a+xs your_app
    the result is the same as before.

  10. #10
    Join Date
    May 2010
    Posts
    42

    Default Re: why can't QProcess read all output?

    Quote Originally Posted by Zlatomir View Post
    No, don't use that in Qt.

    Use that in your C application (if you have the source of the C application)
    unfortunately,i haven't the soures of the C application.

Similar Threads

  1. Can't get QProcess output
    By croscato in forum Qt Programming
    Replies: 6
    Last Post: 18th November 2010, 15:56
  2. Problem with QProcess and output
    By mmm286 in forum Qt Programming
    Replies: 0
    Last Post: 3rd November 2009, 16:42
  3. Help on QProcess - Output Read
    By augusbas in forum Qt Programming
    Replies: 5
    Last Post: 24th September 2009, 11:54
  4. QProcess and capturing output
    By Aragorn in forum Qt Programming
    Replies: 7
    Last Post: 3rd May 2007, 16:57
  5. QProcess output in TreeView?!?
    By nupul in forum Qt Programming
    Replies: 1
    Last Post: 2nd May 2006, 08:05

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
  •  
Qt is a trademark of The Qt Company.