Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran; Calling an executable that in turn runs an input file

  1. Oct 8, 2009 #1
    Hi. I need to write a fortran program that calls an EXE, call it "runner.exe" that in turn runs an input file, call it "run.inp". Thing is, I would normally run "runner.exe" manually, and type in "run.inp" and "runner.exe" gives outputs. But now, I have 100's of input files and I can't affod to do it manually anymore so I need to automate the process, that is, have a program that calls "runner.exe" and "runner.exe" calls all the 100's of input files. How do I do that ?
    I have tried [ Call system ('runner.exe') ] and all that does is actually run "runner.exe" but remember, "runner.exe" is in turn waiting for me to type in an input file. So how do I automate the process ?
    Note: "runner.exe" was written by someone else and lets assume I don't have the code.
    Many thanks.
     
  2. jcsd
  3. Oct 8, 2009 #2

    rcgldr

    User Avatar
    Homework Helper

    Create a program to create a set of files named in001.txt, in002.txt, ... in100.txt. In each text file, include the name of the file you want to use for input. Then the program should write a batch file, with the following lines:

    runner <in001.txt
    runner <in002.txt
    ...
    runner <in100.txt

    I'm not sure what you're doing with the output, but if you want it all in a single file:

    delete out.txt
    runner <in001.txt >>out.txt
    runner <in002.txt >>out.txt
    ...
    runner <in100.txt >>out.txt
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Fortran; Calling an executable that in turn runs an input file
  1. Fortran Input File (Replies: 1)

Loading...