I think you should read after the process has finished.
I think you should read after the process has finished.
but if app using flush(stdout) first method can be possible?Originally Posted by wysota
a life without programming is like an empty bottle![]()
No, because you still might try to read the data before the process has written it.Originally Posted by zlatko
Hmm.. this works fine on Linux (Ubuntu, Qt 4.1.1, gcc 4.0.2) but not in Windows (XP+SP2, Qt4.1.1, VS2003).
Qt Code:
QProcess proc; proc.waitForFinished(-1); qDebug() << proc.readAll();To copy to clipboard, switch view to plain text mode
Edit: means that it outputs correct info in linux, and nothing in windows..
Is the Qt application built as console, or are you checking the dDebug output with the debugger? Otherwise you wont see any qDebug output on windows.Originally Posted by jpn
With a debugger... I can see qDebug() outputs fine, that is not the problem.Originally Posted by seneca
Reading all output at once, even after the application is finished is not a very good idea. For short outputs it is fine, but if you expect a large amount of data to come through that pipe, you should use a signal/slot mechanism to read the data as it comes in. Why? Because it may happen that you fill the pipe buffer between those two processes and the child process will never finish, because it'll be waiting until some of the buffer is read so that it can write all the remaining data. So you should use readyReadStdout() and family.
My point is, that I never get any output on windows with the above code.
Even when I set the working dir so that the output is expected to be extremely short.
Because there is no "dir" executable on Windows. "dir" is a command.com (or cmd.exe) command, so you have to run it from the shell. There are threads on this forum that cover the topic, maybe you should take a look at them.Originally Posted by jpn
jpn (3rd March 2006)
Ahh, now I get the point..Originally Posted by wysota
Bookmarks