PDA

View Full Version : UNABLE TO DISPLAY OUTPUT USING QTextStream



ayanda83
11th July 2012, 06:10
Hi everyone, I'm trying to display output for my console program using QTextStream but it doesn't work. I have included the directory and i have defined cout. But when I for example write cout << "Hello world" it doesn't work until I change cout to qDebug(). The problem is, I don't know what the difference is between QDebug and QTextStream. Please help.

mvuori
11th July 2012, 06:40
You need to tackle problems one by one. The first on is that cout doesn't work -- QTextStream class has no role in this. Google 'qt cout' for plenty of discussions about why cout might not work.

ayanda83
11th July 2012, 07:41
Thank you Mvuori, I googled it and it turn out "cout" in Qt needs to be preceeded by "endl" or "flush". thanks

wysota
11th July 2012, 08:15
Calling a QTextStream instance "cout" will not make it print to the console.