Question: Consider the following code snippet: int main 1 char * buf; char * str; int ret; int fd = open ( input . txt
Consider the following code snippet:
int main
char buf; char str;
int ret;
int fd openinput txt OCREAT ORDWR;
pidt pid fork;
switch pid
case :
perrorError: fork error
;
case :
printfChild use fd: d
fd;
str "Hello from the child";
ret writefd str strlenstr;
printfChild write s ret: d
str ret;
fflushstdout ;
closefd;
break;
default:
printfParent use fd: dchild pid: d
fd pid;
buf char malloc sizeofchar;
sleep;
Iseekfd SEEKCUR;
ret readfd buf, ;
printfParent read s ret: d
buf, ret;
fflushstdout;
break;
return ;
Which of the following statements isare false choose all that apply
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
