Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Fortran

Idiom #111 Launch other program

From current process, run program x with command-line parameters "a", "b".

program p
   integer :: i

   call execute_command_line("x a b", exitstat=i)
   print *, "Exit status of x was ", i

   call execute_command_line("x a b", wait=.false.)
   print *, "running x in the background"
end program p 
#include <stdlib.h>
int system("x a b");

This spawns a shell and returns, when the child process has exited.

New implementation...
< >
programming-idioms.org