Answered step by step
Verified Expert Solution
Question
1 Approved Answer
complete a - f and you will get your thumbs up char * buf1[7]; buf1[0] = T; buf1[1] = H; buf1[2] = O; buf1[3] =
complete a - f and you will get your thumbs up
char * buf1[7];
buf1[0] = T;
buf1[1] = H;
buf1[2] = O;
buf1[3] = U;
buf1[4] = G;
buf1[5] = H;
buf1[6] = T;
char *buf2[7];
int nread, nwrite;
fd = open("file1.txt", O_RDWR);
(a)
nwrite = write(fd, buf1, 4);
(b)
lseek(fd, (offset_t) 2, SEEK_SET);
(c)
nwrite = write(fd, buf1, 5);
(d)
lseek(fd, (offset_t) -4, SEEK_END);
(e)
nread = read(fd, buf2, 4);
(f)
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. Enter the Read-Write Pointer (or, file pointer) values at time instants (a) through (f) char * buf1 [7]; buf1[0]= 'T'; bufi[1] = ' H '; bufi[2] = ' 0 '; buf1[3] = ' U '; buf1[4] = 'G'; buf1[5] = ' H '; bufi[6] = ' T '; char *buf2[7]; int nread, nwrite; fd= open("file1.txt", O_RDWR); (a) nwrite = write (fd, buf1, 4); (b) Iseek(fdd, (offset_t) 2, SEEK_SET); (c) nwrite = write (fd, buf1, 5); (d) Iseeke(fd, (offset_t) -4, SEEK_END); (e) nread = read(fd, buf2, 4); (f)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started