Redirecting stdout/stdin in running process without P/Invoke

  • Thread starter Thread starter Jacek
  • Start date Start date
J

Jacek

Hello!

My application has to use external native library writing to stdout and
stdin. My goal is to redirect output within running process (no chance to do
that in child process - Process class redirection is useless in that case)
and I would like to do it without reverting to C-run time library P/Invoke
calls.

Any ideas how to do that?

Jacek
 
Thanks for suggestion but it is not a solution in my case since it redirects
only managed output and input operations on Console class. It has no effect
on underlying stdin stdout streams attached to process - when you write from
unmanaged code to those streams output or input not redirected after call to
Console.SetOut() or Console.SetIn(). - so you end up with output on console.
It would be nice if Console would work that way but it doesnot.

Reason I asked is that I would prefer to avoid going to P/Invoke for
C-Runtime library calls as they are sometimes quite tricky, much more than
Win32 API.

Jacek
 
Back
Top