I need some help with controlling the execution of a .EXE file from my Fortran code. I have to configure and call an application from my code. To do this, I write all the necessary inputs into a text file, and I call the .EXE together with the input via a batch file, using SYSTEM = RESULT (C:\MyCode\App.bat). The problem is that the external application (App.exe) is not 100% reliable, and sometimes it just blocks during execution, also blocking my code on the SYSTEM = RESULT line. If I terminate the external program manually (for ex. I simply use End Process from Win Task Manager), my code can continue without problems. However, I have to perform hundreds of calls of the external App.exe, over several hours, and I need to find a way to automatically terminate it when things go bad. I want to know if there is any way of monitoring, from within my code, the progress of the App.exe, and to terminate it if, for example, it has not finished in a given amount of time (knowing that a "normal" execution should take a couple of minutes).
I am only a beginner in programming, please answer keeping this in mind. Thanks a lot for your help.