/* program for execute system call */
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h> // for datatypes
#include<sys/types.h> // for standard symbolic constants & types
int main(int argc, char *argv[])
{
int ret;
printf("\n the pid is %d \n",getpid());
ret=execl("/bin/ls","ls","-l",NULL); // path the command (ls -l )
printf("failed process is %d",ret);
return 0;
}
output:
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h> // for datatypes
#include<sys/types.h> // for standard symbolic constants & types
int main(int argc, char *argv[])
{
int ret;
printf("\n the pid is %d \n",getpid());
ret=execl("/bin/ls","ls","-l",NULL); // path the command (ls -l )
printf("failed process is %d",ret);
return 0;
}
output:
No comments:
Post a Comment