Question: Problem 1 . A certain file foo contains the ASCII text string This file contains 2 8 bytes.. That is , the bytes of the
Problem A certain file foo contains the ASCII text string "This file contains bytes.". That is the bytes of the file, viewed as bit integers, contain the values xxxx and x etc.
a Suppose a program opens foo for reading and writing file descriptor fd is returned and it contains a declaration char buf;
The program then does the following.
if rv readfdbuf,handle error... if rv writefdbuf, handle error...
Assuming both calls return what does the file contain after this code runs?
b Suppose the same program next calls lseekfdSEEKSET to rewind the file offset to the beginning, and then does the following:
if rv readfdbuf,handle error... strcpybuf"That"; if rv writefdbuf,rv handle error...
What does the file now contain?
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
