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!
Re: any way to catch error message from dll in a gui app?
Try using a textstream connected to StdErr
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.