Course Solutions Uncategorized (Solved) : Include Include Include Int Main Int Args Char Argv Pidt Forkreturn Pidt Pid Pid Getpid Fo Q26380186 . . . .

(Solved) : Include Include Include Int Main Int Args Char Argv Pidt Forkreturn Pidt Pid Pid Getpid Fo Q26380186 . . . .

 

#include <stdio.h>

#include <sys/types.h>

#include <unistd.h>

int main (int args, char *argv[])

{

pid_t fork_return;

pid_t pid;

pid=getpid();

fork_return = fork();

// When fork() returns -1, an error happened.

if (fork_return==0)

// When fork() returns 0, we are in the child process.

{

printf(“nnThe values are Child ID = %d, Parent ID=%dn”,getpid(), getppid());

execl(“/bin/cat”, “cat”, “-b”, “-v”, “-t”, argv[1], 0);

}

else

// When fork() returns a positive number, we are in the parentprocess

// and the return value is the PID of the newly created childprocess.

{

wait(NULL);

printf(“nChild Completes ” );

printf(“nIn the Parent Processn”);

printf(“Child Id = %d, Parent ID = %dn”, getpid(),getppid());

}

return 0;

}

Q1 Once this program is typed, and executed, answer thefollowing questions

a. If you try to print a

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post