Silverfrost Forums

Welcome to our forums

Calling an external program

23 Jul 2007 8:12 #2101

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.

24 Jul 2007 7:10 #2105

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.

18 Apr 2017 11:49 #19428

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...

18 Apr 2017 12:53 #19429

Yes that is the way it is coded and there should be no reason to change it.

18 Apr 2017 12:58 #19430

Thanks! Would be useful to mention this feature in the help system, it makes it very much easier to control one program from another.

18 Apr 2017 1:14 #19432

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:

https://forums.silverfrost.com/Forum/Topic/2846&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

18 Apr 2017 1:14 #19433

OK. I will see what can be done.

Please login to reply.