开发者

How do I tie into the standard input and output with C#?

What I am trying to do is see if I can u开发者_C百科se the MinGW C++ compiler and debugger to compile files using a C# app. I want to be able to read the output and write to the input (input mainly for the debugger) within the C# app whenever I need to.

Reading from output will be much like Visual Studio does in its 'Output' window durring a project build.

I have used System.Diagnostics.Process before but haven't been able to figure out how to interact with the processes.

So, how do I take control of std input/output?


Redirecting standard input

Reading standard output


The following question shows how to capture standard output:

How do I run a Console Application, capture the output and display it in a Literal?

Writing to standard input is similar -- set RedirectStandardInput to true, and use a streamwriter to write to it:

http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardinput.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜