title: Calling an executable from within Fortran Code
body: <p>I am writing a Fortran code called code.f. I would like this code to run another executable which I can store in the same directory as the code (or as code.f when it is compiled).</p>
  
  <p>Is it acceptable coding to do this using:</p>
  
  <pre><code>    CALL system(./executable &lt; input.inp &gt; output.out)
  </code></pre>
  
  <p>Or is this obviously bad practice?</p>
  
  <p><strong>************ALTERNATIVELY************</strong> </p>
  
  <p>I have the code for the executable, exec.f. Should this be compiled with code.f and linked using the code.f make file, could you possibly advise how to do this, the current make file looks like:</p>
  
  <pre><code>    FFLAGS = $(MYFLGS) -I$(INCDIR) -static
      OBJ =   file1.o file2.o file3.o file4.o
      ...
      ...
      Code:        code.f code.o $(OBJ) par.h
      $(FC) $(FFLAGS) -o $@ code.o $(OBJ) $(LIBS)
  </code></pre>
  
  <p>Would it be correct to just update</p>
  
  <pre><code>   OBJ = file1.o file2.o file3.o file4.o exec.f
  </code></pre>
  
  <p>And after putting in this like how would the code in exec.f be called from within code.f?</p>
  
  <p>Please tell me if I need to make my question clearer. Thank you very much for your help</p>
  
  <p>James</p>