Warning: include(topsc.html): failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/display_menu.html on line 13

Warning: include(topsc.html): failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/display_menu.html on line 13

Warning: include(): Failed opening 'topsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/display_menu.html on line 13

Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 


Warning: include(adsc.html): failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/display_menu.html on line 31

Warning: include(adsc.html): failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/display_menu.html on line 31

Warning: include(): Failed opening 'adsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/display_menu.html on line 31

 
Display menu until press 0 by using child process.

--------------------------------------------------------------------------------

Description : Display menu until press 0 by using child process.

/*A small program that display menu until press 0*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
main()
{
int choice;
do {
printf("---------------=====00=====---------------");
printf("

Main Menu<BR>);
printf("Please select an option that you need:<BR>);
printf(" 1. Executer ls command<BR>);
printf(" 2. Execute ps command<BR>);
printf(" 3. Execute who command<BR>);
printf(" 0. exit<BR>);
printf("
Your choice: ");
scanf("%d", &choice);
//while (getchar() != '
');
switch (choice){
case 1:
if (fork())
wait(0);
else
execlp("ls", "ls", (char *)NULL);
break;
case 2:
if (fork())
wait(0);
else
execlp("ps", "ps", (char *)NULL);
break;
case 3:
if (fork())
wait(0);
else
execlp("who", "who", (char *)NULL);
break;
case 0:
break;
default:
printf("Please enter only 0-3<BR>);
}
}
while (choice != 0);
}

 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG