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

Related Post

No comments yet. Be the first.