Three Descriptors One File
data.txt contains exactly the eight bytes ABCDEFGH. A single process runs:
int a = open("data.txt", O_RDONLY);
int b = open("data.txt", O_RDONLY);
int c = dup(a);
char buf[3] = {0};
read(a, buf, 2); /* (1) */
read(b, buf, 2); /* (2) */
read(c, buf, 2); /* (3) */
Which bytes does each read return?
Sign in to answer questions and track your progress
Sign In