Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using printf in Qt Creator app
Since I mostly do embedded C, I am really used to using printf to write out debug messages and such, including all the number formatting it offers. Can easily use printf in my Qt Creator app to write to a text control or the Application Output window? If I just simply run printf("hello\n") etc, such as in a pushButton_clicked slot, I do not see the output while the app is running. Only after I exit the app, the output appears in the Application Output. Can I make it appear immediately?
I have an answer to my own question. I just happened to see an example of this used in the help. You use qDebug() as if it were printf():
qDebug( "the integer is: %d", 12345 );
andreyc last edited by
Also you can use it in C++ stream way
qDebug() << "the integer is" << 777;
qDebug() will add spaces between parts of a mesage and add eol character.
ChrisW67 last edited by
The first answer contains your options but the second answer here is most informative: