What is that number and what is that character? The single question mark (?) should be replaced with: After the program starts you should enter the character.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Consider the following program. It opens filel and file2 which have already been created with:
rm filel; rm file2; touch filel; touch file2;
echo "ghi" > filel
echo "gst" > file2
Therefore, each file contains 4 bytes.
Here is the program (it will not compile as is because it contains a question mark):
/* problen7.c */
Hinclude cunistd.h>
int main(void)
char buffer "W';
open("file1", 2);
open("file2",2);
1seek (3, ?,1);
write(3,&bufter, 1);
1seek (4, -2,2);
write(4,&buffer, 1);
read(e, &buffer, 1);
write(4, 8buffer, 1);
1seek (3,-3,2);
write(3, &buffer, 1);
write(4, "\n",1);
1seek(4,1,0);
write(4, &buffer, 1);
close(3);
close(4);
Without a further header file compilation will produce a warning, but this will not affect this problem.
When you enter a certain character and the single question mark is replaced with an appropriate number cat filel produces:
gxi
and cat file2 produces:
Transcribed Image Text:Consider the following program. It opens filel and file2 which have already been created with: rm filel; rm file2; touch filel; touch file2; echo "ghi" > filel echo "gst" > file2 Therefore, each file contains 4 bytes. Here is the program (it will not compile as is because it contains a question mark): /* problen7.c */ Hinclude cunistd.h> int main(void) char buffer "W'; open("file1", 2); open("file2",2); 1seek (3, ?,1); write(3,&bufter, 1); 1seek (4, -2,2); write(4,&buffer, 1); read(e, &buffer, 1); write(4, 8buffer, 1); 1seek (3,-3,2); write(3, &buffer, 1); write(4, "\n",1); 1seek(4,1,0); write(4, &buffer, 1); close(3); close(4); Without a further header file compilation will produce a warning, but this will not affect this problem. When you enter a certain character and the single question mark is replaced with an appropriate number cat filel produces: gxi and cat file2 produces:
What is that number and what is that character?
The single question mark (?) should be replaced with:
After the program starts you should enter the character:
Transcribed Image Text:What is that number and what is that character? The single question mark (?) should be replaced with: After the program starts you should enter the character:
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY