Redirecting stdout/stdin in running process without P/Invoke

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
 
J

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top