title: How do you write a C program to execute another program?
body: <p>In linux, I would like to write a C program that launches another program. When the program runs, the shell will be waiting for you to input a command that you have defined in you program. This command will launch the second program.</p>
  
  <p>For example, assume there is a simple C program called "hello" in the same directory as the invoking program. The "hello" program prints the output  "hello, world". The first program would be run and the user would input the command "hello." The "hello" program would be executed and "hello, world." would be output to the shell.</p>
  
  <p>I have done some search, and people suggested the "fork()" and "exec()" functions. Others said to use "system()". I have no knowledge about these functions. How do I call these functions? Are they appropriate to use?</p>
  
  <p>Example code with explanations would be most helpful. Other answers are also welcome. Your help is greatly appreciated.</p>