int main() {
char buf[2];
read((0, buf, 2);
lseek(0, 1, 1);
write(1, buf, 2);
}
The rwl program, whose source code is shown on the top, is run with the following command on a 2-line fileA text file with “01234” data on each line. Determine the data that this command will display and the changes that must be made to the rwl source code in order for the command to be terminated.
$> while rwl; do :; done < fileA
This is an old exam question. Can someone help me solve it?
I tried to put a while(read(0, buf, 2) > 0) and put other 2 inside of loop but it didnt work.
Ozan Aykan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.