[Qt-interest] How to capture stdout and redirect it to the gui?
K. Frank
kfrank29.c at gmail.com
Wed Jan 26 23:42:53 CET 2011
Hello Qt!
I would like to "capture" stdout and redirect it to a logging
window, for example, a QTextEdit.
Jochen Ulrich gave a good solution for doing this with std::cout
a few years back, see:
http://lists.trolltech.com/qt-interest/2005-06/thread00166-0.html
I am using this, and it works well for std::cout, but now I
am using a C library that writes stuff to stdout (not C++'s
std::cout), and I would like to capture this output as well.
I am using Qt 4.6.1 on windows 7 with mingw.
This is not overly urgent. I found a posting that shows how
to set "config += console" in the .pro file so that stdout output
will appear in the console window from which I launch my Qt
application. So I can get the data this way, and make do.
But I would prefer, if possible, to display the output in the
gui, rather than a separate console window.
Would someone know of a solution or have suggestions about
things to try?
Thanks.
K. Frank
More information about the Qt-interest-old
mailing list