HowTo

Here is an example of calling a program from within your program


/*******************************************************************/
/* The Menu program showing off standard C call 'system'           */
/*                                                                 */
/* Nik Swain 1999 : nikswain@oocities.com                         */
/*                                                                 */
/*******************************************************************/

#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<stdlib.h>

char GetKey(void);
int ShowGamesMenu(void);
int ShowMainMenu(void);



int main(void)
{
   ShowMainMenu();

   return 0;
}

char GetKey(void)
{
   char cIn=0;
   do
   {
      cIn = getch();
      cIn = toupper( cIn );

   } while( cIn == 0 );

   return cIn;
}

int ShowGamesMenu(void)
{
   int iKeepGoing = 1;

   while(iKeepGoing)
   {
      system("cls");
      printf("A: Chess\n");
      printf("B: Golf\n");
      printf("C: Formula 1\n\n");

      printf("X: Previous menu");

      char cIn = GetKey();

      switch(cIn)
      {
         case 'A':
            system("\\games\\chess\\chess.exe");
         break;
         case 'B':
            system("\\games\\golf\\golf.exe");
            break;
         case 'C':
            system("\\games\\fm\\fm.exe");
            break;
         case 'X':
            iKeepGoing = 0;
            break;
      }
   }
   return iKeepGoing;

}


int ShowMainMenu(void)
{
   int iKeepGoing = 1;

   while(iKeepGoing)
   {
      system("cls");
      printf("A: Games\n");
      printf("B: Windows\n");
      printf("C: Word Prefect\n\n");

      printf("X: Exit This program");

      char cIn = GetKey();

      switch(cIn)
      {
         case 'A':
            ShowGamesMenu();
         break;
         case 'B':
            system("\\windows\\win");
            break;
         case 'C':
            system("\\wp\\wp");
            break;
         case 'X':
            iKeepGoing = 0;
            break;
      }
   }
   return iKeepGoing;
}

Download source

HowTo