Question: Numeric answers only. 1 . Assume execlp ( ) is successful. How many times will the program output the line of code marked printf (

Numeric answers only.
1. Assume execlp() is successful. How many times will the program output the line of code marked printf("
LINE J")?
2. Assume execlp() failed. How many times will the the program display the calendar ?
3. Assume execlp() failed. How many times will the the program output the line of code marked printf("
LINE K")??
#include
#include
#include
int main()
{
pid_t pid;
pid = fork();
if (pid <0){
fprintf (stderr, "Fork Failed");
return 1;
}
else if (pid ==0){
execlp("/usr/bin/cal", "cal", NULL);
for (int i =0; i <4; i++)
printf("
Line J") ;
for (int i =0; i <2; i++)
printf("
Line K") ;
}
else
{
wait(NULL);
printf("
complete
");
}
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!