April 28, 2009
how to use cout, cin, cerr in QT
Include
#include <QTextStream> #include <stdio.h>
Create these instances globally
QTextStream cin(stdin, QIODevice::ReadOnly); QTextStream cout(stdout, QIODevice::WriteOnly); QTextStream cerr(stderr, QIODevice::WriteOnly);
Then you can use
cout<<QString("bla bla")<<endl
as you wish.
refer: http://lists.trolltech.com/qt4-preview-feedback/2005-03/thread00012-0.html
