The fflush(3) function is supposed to discardunread input. To test how if affects an input stream, create a ?le consisting of 1023 ’a’ characters followed by a newline, followed by 1023 ’b’ character and a newline, followed by 1023 ’c’ characters and a newline, and ?nally 1023 ’d’ characters and a newline. Look at Figure 10 and describe what you think the output will be when you run the program with standardinput redirected from this 4096-byte ?le. Do the results match your expectation? Explain what is happening
he output is a single ’a’ on the ?rst line and a single ’a’ on the second line. Even though the standardI/O library reads morethan a single line of the input ?le (we set the stream to fully-buffered when we called setvbuf), and then discards it when fflush is called, the standardI/O library is smart enough to remember we only consumed one byte before?ushing the stream. Accordingly, it adjusts the ?le offset using lseek(2) so the next byte we read is the second byte in the ?l
You might also like to view...
Which of the following statements is true?
A) The default for a split form orientation is Datasheet on Bottom. B) The default for a split form orientation is Datasheet to the Right. C) The default for a split form orientation is Datasheet to the Left. D) The default for a split form orientation is Datasheet on Top.
Which of the following widths is the largest?
A. column width B. child container width C. parent container width D. content width
Case-Based Critical Thinking Questions ? Case 5-1 You are a student who is new to the more advanced features of Excel. ? ? You have a lot of familiarity with ranges from an earlier Excel class, but you know that there is an alternative that will give you access to additional features that you do not have with a cell range. What is that option?
A. Convert the range to a table. B. Convert the range to an index. C. Convert the range to a PivotChart. D. You are wrong; the range has as many features as any Excel alternative.
If you want to send the value contained in a variable to a function, which method should you use?
A. passing by value B. calling by reference C. calling by value D. passing by reference