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.ans
In your case, inputs.ans
would contain a single 1
or 2
. You can put each additional argument that the program asks for on a new line in this file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.