July 2023
Intermediate to advanced
670 pages
17h 13m
English
Now that we have a program that can display the contents of a file directly to the screen, it’s time to start adding pagination. In this section, we’ll update our program so that we can scroll forward through the contents of a file one page at a time. We need to let the user scroll at their own speed, so we’ll let them press the spacebar to advance one page forward through the document. When they scroll past the last page of the document we should exit the program. We also want to let the user exit the program earlier if they find what they are looking for, so we’ll let them press the q key at any point while they are scrolling through the document to quit immediately.
You probably already have an intuitive idea ...