PDA

View Full Version : Console apps in Kde Qt



peedarp
31st January 2006, 12:24
Hi all,

I am trying to display the strings and values in console.

for that i have added CONFIG += console in pro file, but

I dont know what to use in cpp file to display .

I tried qtextstream but it doesnt help me.

plz give me any ideas.

Mike
31st January 2006, 12:28
if it's for debug purpose use qDebug("Your text goes here");

Other than that you can use standard c / c++ methods, like:

printf("Your text");

or

std::cout << "Your text";

Bojan
31st January 2006, 17:11
You can use std::cout just fine. Or if you want, you can do:


QTextStream output(stdout);
output << "Hello world!";

And that will work with standard output. The same is for stdin and stderr.

Bojan

peedarp
1st February 2006, 07:03
Thank you Mike and Bojan,

I forgot to say my version, I am using 3.3.4 there is no qdebug class.

and I am working in Linux server, the above methods are not working for me.

dec0ding
1st February 2006, 11:37
Thank you Mike and Bojan,

I forgot to say my version, I am using 3.3.4 there is no qdebug class.

and I am working in Linux server, the above methods are not working for me.

the qDebug is present in 3.3.4
the std::cout is widely used on crossplatforms. So it is not platform related. Just if u use cout, try to put 'using namespace std' after the declarations...or the problem is other?:rolleyes:

yop
1st February 2006, 11:43
I am using 3.3.4 there is no qdebug class.
You're right that there is no such class. But noone told you that there's one ;)
http://doc.trolltech.com/3.3/qapplication.html#qDebug