Hello guys
What's wrong with the code below that messagebox displays empty string??
Qt Code:
std::cout<<"bla"; qDebug()<<"ble"; line = stream.readLine(); To copy to clipboard, switch view to plain text mode
Hello guys
What's wrong with the code below that messagebox displays empty string??
Qt Code:
std::cout<<"bla"; qDebug()<<"ble"; line = stream.readLine(); To copy to clipboard, switch view to plain text mode
Last edited by MasterBLB; 19th November 2012 at 10:13.
what is 'stdout' ? Please read my sig.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
http://qt-project.org/doc/qt-4.8/qte...m.html#details
That's the example from Qt doc.
found it by myself,
http://www.cplusplus.com/reference/c...cstdio/stdout/
Added after 11 minutes:
maybe QTextStream doesn't know buffer has changed...
Qt Code:
stream<<"bla"; To copy to clipboard, switch view to plain text mode
I expect that works better...
Last edited by amleto; 20th November 2012 at 11:32.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
That surely works better,but won't help with my goal,which is a Qt GUI program intercepting all what has been sent to standard out and error (ext std::cout << "some input" then displaying that inside let's say QTextEdit.
stdout stands for "Standard Output". The example you linked to uses stdin, which stands for "Standard Input".
You can read from an input file handle and write to an output file handle, but only read/write from a file handle that has been opened for read and write.
Neither of the to standard handles has been opened that way.
You could start a wrapper program that uses QProcess to start the real program and read from the standard output of the child.
Cheers,
_
Bookmarks