I have a fortran main program from which I want to run an executable (foil.exe) with an instructions file (inst.txt). I am actually using the SYSTEMQQ(foil.exe < inst.txt) command, which works well.
Now, since my foil.exe sometimes fails convergence and crashes, I would like to insert the possibility to kill the executable after a fixed time interval. I studied the example provided by Mr. Steve Lionel http://software.intel.com/en-us/forums/topic/275071#comment-1548443, but i have some difficulty as I try to make things work. First, i tried to create a process which just runs the executable foil.exe, and everything is right, in the sense that I am able to control the timeout, and kille the application by the WaitForSingleObject instruction.
Problems arise when i try to add the instruction file to the procedure. As i read from the forum, create process does not accept cmd instructions like '<', so I created a batch file 'script.bat' with the full command ' foil.exe < inst.txts', and I made CreateProcess to run the batch file. The application runs properly, and the instructions are read correctly but, in this case, I am not able to control/kill the process with WaitForSingleObject.
Am I doing something wrong? I have to point out that this is my first experience with CreateProcess instruction. I found this topic http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx which I suspect could be related to my problem, but the fact that it refers to C++ applications poses serious difficulties, as i know nothing, or so, about C++ programming.
Does anyone have any experience of similar situation?
Thank you for your time,