I have a command line application called “MyApp.exe”, that I want to use like this:
DoSomething|MyApp.exe
That is, DoSomething outputs a string to standard out, and then the pipe sends it as standard in to MyApp.exe.
How can I accept this string in MyApp.exe?
UPD.
And what if I want to test this?
I’m using public methods to start my application activity:
using (MyApp app = new MyApp())
{
result = app.Run(args);
}
If(result!=0) Assert.Fail("Failed");
I.e. I need to write some data into input stream before execute Run()
You can use Console.In to access stdin.
Or
Console.ReadLine()which is just a shortcut forConsole.In.ReadLine().