1. Enter the read-writer pointer values at the time instants in the following program. You may...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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) 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)
Expert Answer:
Answer rating: 100% (QA)
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 the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Prepare this part of your research paper on how you could be using Instagram, Facebook, LinkedIn and Pinterest as a social e-commerce platform to promote and strengthen your web presence. Companies...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family. The Incisors own a rental beach house in Hawaii. The beach house was rented for the full year during 2012...
-
Consider a situation with J identical firms that have marginal abatement cost functions for j=1,,J. The marginal damage function is equal to D'(E)=d.EDetermine the optimal allocation and the optimal...
-
A small block of mass m is given and initial speed vo up a ramp inclined at angle to the horizontal. It travels a distance d up the ramp and comes to rest. Determine a formula for the coefficient of...
-
Problem 18-112 (Algo) DJG Corporation purchased land in order to... DJG Corporation purchased land in order to build new corporate headquarters for a purchase price of $769,000. The lawyers charged...
-
If \(X_{t} \sim N(0, t)\), calculate the distribution of \(\left|X_{t} ight|\). Calculate \(\mathbf{E}\left|X_{t} ight|\) and \(V\left(\left|X_{t} ight| ight)\).
-
Consider the following data related to the financial performance of Royal Company. Between 2009 and 2012, income increased by 63 percent, showing a significant increase in income each year. In light...
-
Estimate the value of using Simpson's rule. 15 x+1 15 dx by using n=4 subintervals of equal width
-
Create and insert an ERD showing the constellation ERD schema below. Please see requirements in the next two sections. Determine four to five (non-date/time) dimension tables a. SCDs need to be...
-
On 12/12/2020 smith inc purchased merchandise on account from suppliers. On 12/20/2020 smith inc paid its suppliers for half of the merchandise purchased. Smith inc did not record either of these...
-
Distinguish between separate and marital property. Give an example of each.
-
For a recent 2-year period, the statement of financial position of Jiang Group showed the following equity data at December 31 (amounts in millions). Instructions (a) Answer the following questions....
-
Identify the general rule with respect to the classification of personal injury awards as separate or marital property.
-
Describe the significance of the Orr decision.
-
Distinguish between alimony and property division.
-
Marcello's Pizza charges a base price of $18 for a largepizza plus $1.50 for each additional topping. (a) Find a function f that models the priceof a pizza with n toppings. f ( n ) = (b) Find the...
-
How is use of the word consistent helpful in fraud reports?
-
Jim is fired from his job as a waiter and decides to take an extended trip to Europe. After touring Europe for 3 months, Jim returns to look for a new job as a waiter. Are his job-hunting expenses...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-7. Ivan sold the following securities during the year and received a Form 1099-B that...
-
Brian and Kim have a 12-year-old child, Stan. For 2012, Brian and Kim have taxable income of $52,000, and Stan has nonqualifying dividend income of $4,500 and investment expenses of $250. No election...
-
A project under consideration has a 10-year projected life. The initial investment for the project is estimated to have a mean of \(\$ 10,000\) and a standard deviation of \(\$ 1,000\). The annual...
-
True or False: In determining the optimum replacement interval, it is necessary to assume negligible salvage values.
-
Uncertainty can impact many elements of an engineering economic analysis. Given the list of factors below, rank them from most to least uncertain, and briefly justify why you ranked them in that...
Study smarter with the SolutionInn App