Reputation: 6171
Given the following calls:
printf ("Characters: %c %c \n", 'a', 65);
qDebug() << "adcasd";
Why I see the following (inverted) output in the QtCreator Application Output?
adcasd
Characters: a A
Upvotes: 2
Views: 2374
Reputation: 1769
printf
is only flushed automatically with a new line if it can be detected to refer to an interactive device. I'm not sure what is the case here, but you could try to flush is explicitly with fflush(stdout);
after the line with printf
command.
Upvotes: 1
Reputation: 2033
printf() writes directly to stdout and flushes every time it hits a line break. qDebug() writes to the debugger. Qt Creator displays both in the same window (but usually in different colors), but they are two different streams. Thus the order of output can get mixed up a little.
Upvotes: 6