I will start from the C++ application to explain my exact requirement. I had a C++ application , which takes an input (a small command called “run”) from console (keyboard) with out using any arguments( C++ application is using getchar() in the project). well the problem i am able to run the exe file from C# using System.Diagnostics.Process, but i want to enter the command “run” programitically in C# to execute C++ Application. Is it possible to do that?
Share
Yes it is. You need to redirect the spawned process’s input stream so that you can write to it directly:
Now this will write to your process’s standard input, just as if you had typed the text using the keyboard:
Finally, when you are done writing, don’t forget to clean up: