//===================================================== file = system.c =====
//=  A simple example of the system() call in Windows 9X/NT                 =
//===========================================================================
//=  Notes:                                                                 =
//=    1) This program demonstrates how the system() call works.  The       =
//=       system() call invokes the command processor to execute a          =
//=       system command, batch file, or other program from inside an       =
//=       executing C program.                                              =
//=    2) This program requires that hello.exe be in the same directory     =
//=    3) The program "spawned" from the system call cannot be killed.      =
//=    4) This program is only for Windows 9X/NT can compiles with both     =
//=       Borland and Microsoft compilers                                   =
//=-------------------------------------------------------------------------=
//= Example execution: (note that thread id's vary between runs)            =
//=                                                                         =
//=   Executing system()...                                                 =
//=       Hello World - - - iteration #1                                    =
//=       Hello World - - - iteration #2                                    =
//=       Hello World - - - iteration #3                                    =
//=       Hello World - - - iteration #4                                    =
//=       Hello World - - - iteration #5                                    =
//=       Hello World - - - iteration #6                                    =
//=       Hello World - - - iteration #7                                    =
//=       Hello World - - - iteration #8                                    =
//=       Hello World - - - iteration #9                                    =
//=       Hello World - - - iteration #10                                   =
//=   End!                                                                  =
//=-------------------------------------------------------------------------=
//=  Build: bcc32 system.c, cl system.c                                     =
//=-------------------------------------------------------------------------=
//=  Execute: system                                                        =
//=-------------------------------------------------------------------------=
//=  Author: Kenneth J. Christensen                                         =
//=          University of South Florida                                    =
//=          WWW: http://www.csee.usf.edu/~christen                         =
//=          Email: christen@csee.usf.edu                                   =
//=-------------------------------------------------------------------------=
//=  History: KJC (11/18/98) - Genesis                                      =
//===========================================================================

//----- Include files -------------------------------------------------------
#include <stdio.h>      // Needed for printf()
#include <stdlib.h>     // Needed for system()

//----- Defines -------------------------------------------------------------
#define FILE_NAME  "hello.exe"    // Name of program to execute as a process

//===========================================================================
//=  Main program                                                           =
//===========================================================================
void main()
{
  int error_code;       // Error code returned by system()

  // Output a banner
  printf("Executing system()... \n");

  // Execute the system call
  //  - Note that the system() call blocks the main program
  system(FILE_NAME);

  // All done
  printf("End! \n");
}

