#include<stdio.h>
#include<sys/resource.h>a
#include"myHeader.h"
main()
{
printf("system=%d parent=%d\n",getpid(),getppid());
printf("p2 id=%d \tp2 parent=%d\n",getpid(),getppid());
system("date");
system("cal");
system("./system");
printf("p2=%d parent=%d\n",getpid(),getppid());
}
OutPut:
madan@madan-Lenovo-G570:~/madan/osconcepts$ cc ex44.c
madan@madan-Lenovo-G570:~/madan/osconcepts$ ./a.out
system=6169 parent=2817
p2 id=6169 p2 parent=2817
Fri Apr 4 09:10:48 IST 2014
April 2014
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
sh: 1: ./system: not found
p2=6169 parent=2817