Question: Enter the read - writer pointer values at the time instants in the following program, ( a ) through ( j ) . You may

Enter the read-writer pointer values at the time instants in the following program, (a) through (j). You may assume it is executed from the beginning to the end. Assume that the file, file1.txt, exists and is empty. (70 points)1. char * buf1[5];
buf1[0]=T;
buf1[1]=K;
buf1[2]=D;
buf1[3]=Y;
buf1[4]=U;
char *buf2[3];
int nread, nwrite; fd = open("file1.txt", O_RDWR);
(a) nwrite = write(fd, buf1,3);
(b) lseek(fd,(offset_t)2, SEEK_SET);
(c) nwrite = write(fd, buf1,5);
(d) lseek(fd,(offset_t)-3, SEEK_END);
(e) nread = read(fd, buf2,3);
(f) lseek(fd,(offset_t)-2, SEEK_CUR);
(g) nwrite = write(fd, buf1,3);
(h) lseek(fd,(offset_t)-4, SEEK_CUR);
(i) nwrite = write(fd, buf1,2);
(j) 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). HINT: You need to enter 8 characters. (20 points)
2. What would be the contents of the array, buf2[3], 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). HINT: You need to enter 3 characters. (20 points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!