Results 1 to 4 of 4

Thread: UNABLE TO DISPLAY OUTPUT USING QTextStream

  1. #1
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Red face UNABLE TO DISPLAY OUTPUT USING QTextStream

    Hi everyone, I'm trying to display output for my console program using QTextStream but it doesn't work. I have included the directory and i have defined cout. But when I for example write cout << "Hello world" it doesn't work until I change cout to qDebug(). The problem is, I don't know what the difference is between QDebug and QTextStream. Please help.

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: UNABLE TO DISPLAY OUTPUT USING QTextStream

    You need to tackle problems one by one. The first on is that cout doesn't work -- QTextStream class has no role in this. Google 'qt cout' for plenty of discussions about why cout might not work.

  3. #3
    Join Date
    Jul 2012
    Posts
    201
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: UNABLE TO DISPLAY OUTPUT USING QTextStream

    Thank you Mvuori, I googled it and it turn out "cout" in Qt needs to be preceeded by "endl" or "flush". thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: UNABLE TO DISPLAY OUTPUT USING QTextStream

    Calling a QTextStream instance "cout" will not make it print to the console.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Real time display of QProcess output in a textBrowser
    By Tanny007 in forum Qt Programming
    Replies: 2
    Last Post: 17th December 2015, 04:30
  2. Unable to display image in windows
    By ankireddy in forum Newbie
    Replies: 1
    Last Post: 7th January 2012, 03:58
  3. Display an output buffer (text stream) in QWidget
    By nomiz in forum Qt Programming
    Replies: 8
    Last Post: 30th June 2011, 09:44
  4. QTextStream input and output executing in wrong order
    By jrmrjnck in forum Qt Programming
    Replies: 6
    Last Post: 8th November 2010, 16:33
  5. Unable to display flash into webkit on MAC
    By jay in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2010, 11:23

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.