Results 1 to 3 of 3

Thread: How can I: get rid of qDebug() new line?

  1. #1
    Join Date
    Aug 2011
    Location
    Portugal
    Posts
    34
    Thanks
    15
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Exclamation How can I: get rid of qDebug() new line?

    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 "> ".

    Qt Code:
    1. qDebug() << "> ";
    To copy to clipboard, switch view to plain text mode 

    Output:
    Qt Code:
    1. > \r\n
    To copy to clipboard, switch view to plain text mode 

    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!

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How can I: get rid of qDebug() 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
    Try to call "fflush(stdout);" after printf.

  3. The following user says thank you to stampede for this useful post:

    TCB13 (5th September 2011)

  4. #3
    Join Date
    Aug 2011
    Location
    Portugal
    Posts
    34
    Thanks
    15
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I: get rid of qDebug() new line?

    Quote Originally Posted by stampede View Post
    Try to call "fflush(stdout);" after printf.
    Works like a charm

    Thanks.

Similar Threads

  1. using qdebug
    By GrahamLabdon in forum Newbie
    Replies: 2
    Last Post: 3rd February 2011, 09:59
  2. Replies: 3
    Last Post: 13th August 2010, 11:50
  3. Image reading and writing line by line
    By Astrologer in forum Qt Programming
    Replies: 7
    Last Post: 29th April 2010, 08:15
  4. qDebug() on OSX
    By December in forum Qt Programming
    Replies: 1
    Last Post: 7th October 2008, 17:14
  5. qdebug
    By drkbkr in forum Qt Programming
    Replies: 12
    Last Post: 29th September 2006, 15:26

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.