Will loading a DLL dynamically reconcile its stderr to a main application? If so, then how…?

后端 未结 2 1357
日久生厌
日久生厌 2021-01-06 19:24

I\'m writing a GUI application, using Qt, which links to a third-party DLL that sometimes sends error messages to stderr. I\'d like these error messages to be displayed in a

2条回答
  •  天命终不由人
    2021-01-06 19:56

    Does the DLL really write to stderr? Or does it write to GetStdHandle(STD_ERROR_HANDLE) ? The first maps to the second, initially. But with freopen() you merely change the mapping. Anything written to STD_ERROR_HANDLE will still go there.

    To redirect everyones error output, you would need SetStdHandle.

提交回复
热议问题