#define BUFSIZE 10 char buf [BUFSIZE]; fd = open("foo.txt", O_RDONLY) ; while (read(fd, buf, BUFSIZE) > 0); Assuming neither open() nor read() returns an error, what does buf contain after this code is executed? In the figure below, show the contents of each byte of the buffer: For an ASCII character, put it in quotes (e.g., for a space, put ' '); if a byte contains zero, write Ø; if its contents are unknown, put a question mark (no quotes).

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 13RQ: How is an array stored in main memory? How is a linked list stored in main memory? What are their...
icon
Related questions
Question

he file “foo.txt” is exactly 16 bytes long, and contains the 16
ASCII characters “Now is the time.” in that order. Suppose the code below is executed.

#define BUFSIZE 10
char buf [BUFSIZE];
fd = open("foo.txt", O_RDONLY);
while (read (fd, buf,BUFSIZE) > 0);
Assuming neither open() nor read() returns an error, what does buf contain after this
code is executed? In the figure below, show the contents of each byte of the buffer: For an
ASCII character, put it in quotes (e.g., for a space, put ' '); if a byte contains zero, write
Ø; if its contents are unknown, put a question mark (no quotes).
Transcribed Image Text:#define BUFSIZE 10 char buf [BUFSIZE]; fd = open("foo.txt", O_RDONLY); while (read (fd, buf,BUFSIZE) > 0); Assuming neither open() nor read() returns an error, what does buf contain after this code is executed? In the figure below, show the contents of each byte of the buffer: For an ASCII character, put it in quotes (e.g., for a space, put ' '); if a byte contains zero, write Ø; if its contents are unknown, put a question mark (no quotes).
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning