Question: Given the c code below what is printed to the after invoking the program what is printed to standard output,what is in fileB.txt , and
Given the c code below what is printed to the after invoking the program what is printed to standard output,what is in fileB.txt and what is in fileA.txt All syscalls succeed
The program is invoked like the following:
$ cat fileA.txt
File text a
$ cat fileB.txt
File text b
$aout
$ echo hello world
Program:
char space;
int B openfileBtxt OWRONLY OCREAT OAPPEND,
int A openfileAtxt ORDONLY;
printfHi
;
dupB STDOUTFILENO;
printfGood
dupA STDINFILENO;
for ;;
ssizet bread readSTDINFILENO, space, sizeofspace; if bread
return ;
ssizet bwrite bread; while bwrite
bwrite writeSTDOUTFILENO,
space breadbwrite, bwrite;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
