PDA

View Full Version : How can I: get rid of qDebug() new line?



TCB13
5th September 2011, 12:12
Hi!

I've seen this questions asked in StackOverflow and in a old MailList, but none of the answers really work or do what I want to do...

In the past, before I used QT I was developing console applications in C and used fgets at stdin to get info from the user most of the time.
And usually I printed out the ">" char to make the feel that the program was waiting for into to be entered.

But now with qDebug() I always get a new line after printing my "> ".


qDebug() << "> ";

Output:
> \r\n

And of course it blows the entire feel of "write something here!"
How can I get rid of the "new line"?

Another thing I noticed that if I "old-school" printf in slots is not printed in the time it should be why? Usually it only appears on the screen after a qDebug() is issued by another slot :S

Thanks!

stampede
5th September 2011, 12:28
Another thing I noticed that if I "old-school" printf in slots is not printed in the time it should be why? Usually it only appears on the screen after a qDebug() is issued by another slot :S
Try to call "fflush(stdout);" after printf.

TCB13
5th September 2011, 13:03
Try to call "fflush(stdout);" after printf.

Works like a charm ;)

Thanks.