From the course: Exploring C Libraries

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Challenge: Fill the screen

Challenge: Fill the screen - C Tutorial

From the course: Exploring C Libraries

Challenge: Fill the screen

(lively music) - [Instructor] Your challenge is to code an ncurses program that fills the screen with a character typed at the keyboard. This challenge requires some knowledge of ncurses, provided in this chapter, but you must also know a new function to help code your solution. The program works like this. Prompt the user to type a character or the tilde to quit. Type an A and the screen instantly fills with the letter A. Type a plus, the number five. You get the idea. Any other character typed fills the screen, as shown here. Type the tilde to quit. Here are the details. Your solution should use the basic ncurses skeleton, including the startup function: initscr(), and the cleanup function: endwin. Use the getmaxyx() function to obtain the standard screen's width and height, as demonstrated in this course. Output the initial prompt, type a character; tilde to quit and refresh the standard screen. The action part of the program requires a loop, uses the getch() function to read from…

Contents