ie;- Program to demonstrate Exec family.
Note:- execute a user define program.
step 1: Write two programs 1) execdemo.c
2) add.c (ie: this could be any user program without exec system call,
source code of both the programs is given below)
// execdemo.c
#include<
#include<
int main()
{
printf("Demonstration of EXECL system call by executing user program\n");
execl("./add","add",(char*)0);
printf("This will not be printed\n");
}
// add.c
#include<
int main(int argc,char *argv[])
{
int a,b,c;
a=10;
b=20;
c=a+b;
printf("Addition of %d and %d is %d\n",a,b,c);
}
step 2: Compile first program with command ------- cc execdemo.c
Compile second program with command ------ cc -o add add.c ( here the object will go in "add" file)
step 3: execute as ------ ./a.out
1 comment:
hello sir can u pl leave ur email id as i had some doubts would be very greatfulllll............
Post a Comment