Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

System Command in Fortran

katejohnso
Beginner
1,543 Views

I am having trouble with the System command in my code. The specific line is:
I1 = SYSTEM('Simulation < c:\\data\\simu.dat')

Which, if I understand correctly, recognizes Simulation as Simulation.exe located in the working folder and simu.dat is the main file read by Simulation and runs Simulation.exe as if opening the exe on the desktop. However, I get a message when debugging that says 'the system cannot find the file specified." I've heard that the SYSTEM command is very compiler specific, but that's about all the information I've been able to find. Has anyone used this before?

0 Kudos
5 Replies
IanH
Honored Contributor III
1,543 Views
That error is more likely because the file C:\data\simu.dat cannot be found. Does it exist?
0 Kudos
katejohnso
Beginner
1,543 Views
Sorry, my mistake. The file had been renamed so you're right, it couldn't be found. The error message is actually 'Simulation' is not recognized as an internal or external command, operable program or batch file.
0 Kudos
Steven_L_Intel1
Employee
1,543 Views
Are you sure that simulation.exe is in the default folder? This would be the project folder if running from within Visual Studio. Maybe try replacing the string with "DIR" and see what you get.
0 Kudos
katejohnso
Beginner
1,543 Views

The file was not located in the correct subfolder, however I moved it down and now I am getting an error that says Program Exception - Breakpoint which when I've gotten it before means it can't locate the file. However, according to "DIR," all the files are located in the correct location. Is there another reason I might be seeing this error?

0 Kudos
Steven_L_Intel1
Employee
1,543 Views
Look at the console window for a more detailed error message, such as array out of bounds, etc. It may be hidden behind the debugger window.
0 Kudos
Reply