[Qt-creator] printf() with Qt Creator?

Danny Price deepblue842 at googlemail.com
Sat Apr 24 22:25:52 CEST 2010


Definitely an issue here. I created a C++ project and added CONFIG += console to the pro file. The following does NOT print to the console until after main returns (as shown with a breakpoint)

#include <iostream>
int main()
{
	std::cout << "test";
	return 0;
}


However if I add cout.flush() before the return, the output appears:

#include <iostream>
int main()
{
	std::cout << "test";
	std::cout.flush();
	return 0;
}

The CONFIG += console line appears to have NO EFFECT. This must be a recent regression because I'm sure this used to work. I've not been able to get it to work at all with <stdio.h> as I think it lacks a standard function to flush the buffer.


On 15 Apr 2010, at 08:47, Brad Hubbard wrote:

> Berk Demirkır wrote:
>> A simple program output that prints a lot via printf don't show on Application Output. But when i close this application output shows. Strange issue...
>> 
> Sounds like the output buffer is not being flushed.
> 
> Cheers,
> Brad
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20100424/f1d687f3/attachment.html 


More information about the Qt-creator-old mailing list