I have a FORTRAN .exe file which runs and works ok, it will ask
user to input 1 or 2 and if 1 is entered it will do some calculation and if 2 is entered it does different kind of calculation.
I need to call this from C# code. I know how to run .exe file from C# but I can not pass 1 or 2 to the .exe
I have used different method but with no luck.
static void Main(string [] args)
{
string FileName = @"C:\......sco.exe";
process.StartInfo = new ProcessStartInfo(FileName,"3");
Process.Start(process.StartInfo); }
I really appreciate if some one knows how to fix this problems. I am new to C# and I can not rewrite the Fortran code since it is too comelicated.
Thank you for reading this post
I don’t know C#, so I can’t tell you how to do this in detail, but when running a fortran program from the command line, you can supply an extra file with arguments. Call it like this:
mypgrogram.exe<inputs.ansIn your case,
inputs.answould contain a single1or2. You can put each additional argument that the program asks for on a new line in this file.