Question: This problem is about the same file foo as in the previous problem, but before it is modified. A program opens it for reading
This problem is about the same file foo as in the previous problem, but before it is modified. A program opens it for reading and gets back the file descriptor number fd. The program has a character array char buf [30]. The program now does the following: if ((rv = read (fd, buf,20)) < 0) {...handle error... } if ((rv = read (fd, buf, 20)) < 0) {...handle error...} a. What does each call return (assuming no errors)? b. What do the first 20 bytes of the character array buf contain after the second read call? c. What do the last 10 bytes of buf contain?
Step by Step Solution
There are 3 Steps involved in it
Lets analyze each part of the code c char buf30 int rv First read if rv readfd buf 20 0 handle error ... View full answer
Get step-by-step solutions from verified subject matter experts
