View previous topic :: View next topic |
Author |
Message |
carpe85
Joined: 21 Jul 2007 Posts: 1
|
Posted: Mon Jul 23, 2007 9:12 pm Post subject: Calling an external program |
|
|
Hi:
I have an executable program (call it "Testing") created in Fortran (I don't have the fortran file, only the executable). I need to run "Testing" 1000 times, so I want to write a fortran code to do it with different inputs.
The ideas is that my code will read a series of inputs and then run the external executable "Testing" with these inputs. It will have to call the program, input the data to the program (which will produce some output files), and then go to the next set of inputs to rerun "testing"/
The inputs are really simple. I was advised that it is possible, but after browsing the user's guide for a while I still have no clue.
I would appreciate any help. Thank you. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Jul 24, 2007 8:10 am Post subject: |
|
|
The first thing to do is to work out how to run your program (testing) from a command line in a DOS box (command prompt window).
Then write a FTN95 program that calls START_PROCESS@ using a command line for just one run. Then you can extend your program to handle you 1000 runs. |
|
Back to top |
|
|
davidsimmonds36
Joined: 18 Apr 2017 Posts: 2
|
Posted: Tue Apr 18, 2017 12:49 pm Post subject: START_PROCESS@ |
|
|
It seems that if I use START_PROCESS@ to run another Silverfrost FTN95 program, which terminates with CALL EXIT(errorcode), then the START_PROCESS@ function returns the value of errorcode to the original program. This is extremely useful, but doesn't seem to be documented (I found it by accident whilst trying to get the errorcode another way!). Is it an intentional and reliable feature? I very much hope it is... |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Apr 18, 2017 1:53 pm Post subject: |
|
|
Yes that is the way it is coded and there should be no reason to change it. |
|
Back to top |
|
|
davidsimmonds36
Joined: 18 Apr 2017 Posts: 2
|
Posted: Tue Apr 18, 2017 1:58 pm Post subject: |
|
|
Thanks! Would be useful to mention this feature in the help system, it makes it very much easier to control one program from another. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Tue Apr 18, 2017 2:14 pm Post subject: |
|
|
David,
If you want more sophisticated interaction between programs written in FTN95 you can pass messages between them.
There is a discussion in this thread:
http://forums.silverfrost.com/viewtopic.php?t=3222&highlight=message+passing
- and probably elsewhere, as message passing is one of my interests and I'm sure I posted more than once on the subject. EXIT error codes are one-way only, although restarting a program is trivial and usual quite fast.
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Tue Apr 18, 2017 2:14 pm Post subject: |
|
|
OK. I will see what can be done. |
|
Back to top |
|
|
|