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
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

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

    Quote Originally Posted by Zlatomir View Post
    @Wysota: I didn't said you are wrong, and you are right about line-buffer in *nix, but this isn't a behavior that you can assume it's true (especially if you want multi-platform)
    Can you point a platform that doesn't perform a flush on newline?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    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
    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.
    Check out PAM.

    Quote Originally Posted by wysota View Post
    Can you point a platform that doesn't perform a flush on newline?
    What would also be interesting is that if you open a file as binary, you don't (or at least, I would expect you didn't) get flushing on newline. Do you get fliushing on endl even though the file is binary? I know using endl on a binary file is a bit strange, but it would be interesting to find out. Unless of course endl on a binary file causes a run time error?

  3. #3
    Join Date
    May 2010
    Posts
    42

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

    [QUOTE=fatjuicymole;146411]Check out PAM.


    what the "PAM" reffers to?

  4. #4
    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?


  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

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

    Quote Originally Posted by fatjuicymole View Post
    What would also be interesting is that if you open a file as binary, you don't (or at least, I would expect you didn't) get flushing on newline. Do you get fliushing on endl even though the file is binary? I know using endl on a binary file is a bit strange, but it would be interesting to find out. Unless of course endl on a binary file causes a run time error?
    I would expect a binary stream to be buffered as well. Remember TCP is a binary stream and it is flushed on newline (there are no "modes" for creating a socket).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6

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

    If anyone is still interested, here is a possible workaround for the buffer problem:
    https://sites.google.com/site/marcst...output-channel

  7. #7
    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?

    The OS might flush the stream with new line or might not, we can't know for sure, it might look that in 1000 cases flushes the stream and in one case, when we assume it does... the OS make us a surprise... (i saw some people surprised by this issue)

    I was talking from the C/C++ programmer point of view, for us there is no guarantee that the OS will flush on new line (\n), but in case the programmer isn't "happy" with the OS flushes, he can do it when he want it.

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.