Question: 1. Enter the read-writer pointer values at the time instants in the following program. You may assume it is executed from the beginning to

1. Enter the read-writer pointer values at the time instants in the following program. You may assume it is

1. Enter the read-writer pointer values at the time instants in the following program. You may assume it is executed from the beginning to the end. Assume that the file, "file1.txt", exists and is empty. (40 points) char*buf1[5]; buf1[0]='T'; buf1[1]='K'; buf1[2]='D'; buf1[3]='Y'; buf1[4]='U'; char *buf2[3]; int pread, write fd=open("file1.txt", O_RDWR); (a) nwrite write(fd, buf1, 5); (b) Iseek(fd, (offset t) 2, SEEK_SET); (c) B Dwrite write(fd, buf1, 4); (d) Iseek(fd, (offset t)-5, SEEK_END); (e) Dread read(fd, buf2, 3); (f) = Iseek(fd, (offset t)-4, SEEK_CUR); (g) Dwrite write(fd, buf1, 5); (4) = Iseek(fd, (offset t)-4, SEEK_CUR); awrite-write(fd, buf1, 3); S 2. What would be the contents of the file, "file1.txt", after the above program in problem 1 is completed. Enter a sequence of characters (case sensitive). Do not enter any extra characters such as blank or new-line(Enter). (20 points)

Step by Step Solution

3.50 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a readwriter pointers 0 6 b readwriter pointers 2 2 c readwriter pointers 5 3 d readwriter pointers 0 0 e readwriter pointers 0 3 f readwriter pointer... View full answer

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 Programming Questions!