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.
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.
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";
You can use std::cout just fine. Or if you want, you can do:
Qt Code:
output << "Hello world!";To copy to clipboard, switch view to plain text mode
And that will work with standard output. The same is for stdin and stderr.
Bojan
The march of progress:
C:
printf("%10.2f", x);
C++:
cout << setw(10) << setprecision(2) << showpoint << x;
Java:
java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++) System.out.print(' ');
System.out.print(s);
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.4Originally Posted by peedarp
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?
I am sailing with the cane...
You're right that there is no such class. But noone told you that there's oneOriginally Posted by peedarp
http://doc.trolltech.com/3.3/qapplication.html#qDebug
Bookmarks