I have a C# application in which I'm trying to redirect some text written on to stderror. The text which is written to stderror is actually written by calling a function that is present in some other dll.
I have used CreatePipe
, SetStdHandle
and ReadFile
(in that order) to achieve the mentioned functionality. While I am able to redirect any text that is written in the same C# file using Console.SetError, the text that is written to stderr by the other dll still gets written on the native stderr and is not redirected.
Is there any way to catch/redirect this text? Thanks.