Results 1 to 3 of 3

Thread: Program result writed by qDebug() to file doesn't work.

  1. #1
    Join Date
    Sep 2008
    Location
    Slovakia, Nitra
    Posts
    15
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Program result writed by qDebug() to file doesn't work.

    Hi,

    If i want write result of program to a file (Linux), i use the following command:
    ./prog > file.txt

    It saves only those lines where i use the std::cout in source, but if i use the qDebug() this doesn't save anything at all. Suprisingly in command line both of them works without any problem. Of course i can use the first one, but it's odd.

    Any suggestion?

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Program result writed by qDebug() to file doesn't work.

    you need to set you own message handler for qDebug. read this. but in this thread discussed redirecting to a file, but you can redirect in std:ut.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

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

    Vincenzo (19th March 2009)

  4. #3
    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: Program result writed by qDebug() to file doesn't work.

    qDebug() outputs to std::err not std:ut so you have to redirect the other descriptor. Try this:

    ./prog 2> file.txt
    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.


  5. The following user says thank you to wysota for this useful post:

    Vincenzo (19th March 2009)

Similar Threads

  1. Replies: 5
    Last Post: 29th October 2007, 22:49
  2. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19
  3. Replies: 2
    Last Post: 13th September 2006, 09:11

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.