Results 1 to 3 of 3

Thread: any way to catch error message from dll in a gui app?

  1. #1
    Join Date
    Aug 2010
    Posts
    6
    Thanks
    3
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default any way to catch error message from dll in a gui app?

    I'm using QLibrary to load a dll in a gui app, the problem is how to catch the error message in stderr from the dll.

    dll.cpp
    ...
    std::cerr << "error!" << std::endl;
    ...

    I tried using QFile to open the stderr, but got nothing.
    file.open(stderr, QIODevice::ReadOnly);
    QByteArray msg = file.readAll();

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: any way to catch error message from dll in a gui app?

    Try using a textstream connected to StdErr

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

    lvdong (24th October 2010)

  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: any way to catch error message from dll in a gui app?

    As far as I know stderr is a write-only stream so if something has already been sent to stderr, you won't be able to retrieve it in the same process. But you should be able to redefine std::cerr to something else and intercept the text before it reaches stderr. This is strictly a C++ issue though.
    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:

    lvdong (24th October 2010)

Similar Threads

  1. generic catch-all error during runtime
    By babygal in forum Qt Programming
    Replies: 7
    Last Post: 23rd June 2010, 08:53
  2. error message
    By offline in forum Qt Programming
    Replies: 1
    Last Post: 5th November 2009, 14:08
  3. Showing a error message
    By srohit24 in forum Qt Programming
    Replies: 2
    Last Post: 21st August 2009, 07:05
  4. getting the error message when trying to run the application in QT
    By pallavi Boyapat in forum Qt Programming
    Replies: 49
    Last Post: 31st October 2008, 12:18
  5. what`s means this Error Message?
    By blm in forum Qt Programming
    Replies: 2
    Last Post: 15th September 2008, 16:58

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.