Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C Program 2. mypager This utility displays the contents of a file as ASCII characters, one page at at time. By default, a

Write a C Programimage text in transcribed

2. mypager This utility displays the contents of a file as ASCII characters, one "page" at at time. By default, a page is equivalent to at most 20 lines of text, each line not having more than 80 characters displayed. It is, essentially, a crude version of the less Unix file utility. Following are the specifications 1. The usage of mypager is as follows: mypager 2. When started, it displays the first page of text, meaning up to 20 lines of text from the file, each line having 80 characters or less. 3. It then waits for user input. If the user presses the 'f' key, then the next page is displayed. If the user presses the 'q' key, then the utility quits. This user input code has already been written and is included within the main function 4. You will be supplied with an incomplete version of mypager.c that does not actually display any text. You are to modify several functions within mypager.c in order to make it work correctly. Specifically, you must revise three (3) functions, as follows: fetch_next line: this function retrieves the next line of text by repeatedly calling fetch_next_word; see mypager.c for more details - fetch_next word: this function retrieves the next word of text by reading bytes from a buffer; see mypager.c for more details refill_buffer: this function refills the buffer with bytes read from the file; see mypager.c for more details 5. You may not revise or add any other functions. 2. mypager This utility displays the contents of a file as ASCII characters, one "page" at at time. By default, a page is equivalent to at most 20 lines of text, each line not having more than 80 characters displayed. It is, essentially, a crude version of the less Unix file utility. Following are the specifications 1. The usage of mypager is as follows: mypager 2. When started, it displays the first page of text, meaning up to 20 lines of text from the file, each line having 80 characters or less. 3. It then waits for user input. If the user presses the 'f' key, then the next page is displayed. If the user presses the 'q' key, then the utility quits. This user input code has already been written and is included within the main function 4. You will be supplied with an incomplete version of mypager.c that does not actually display any text. You are to modify several functions within mypager.c in order to make it work correctly. Specifically, you must revise three (3) functions, as follows: fetch_next line: this function retrieves the next line of text by repeatedly calling fetch_next_word; see mypager.c for more details - fetch_next word: this function retrieves the next word of text by reading bytes from a buffer; see mypager.c for more details refill_buffer: this function refills the buffer with bytes read from the file; see mypager.c for more details 5. You may not revise or add any other functions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions