Use ncurses to determine the size of the terminal window, from which you can set the cursor location and output text anywhere. Ncurses also reports the cursor's location on the terminal window. Manipulating the cursor's location is one way you control text output in the terminal window.
- [Instructor] The first thrill … of controlling the terminal screen … is being able to set the cursor … to any valid location. … And to do so, you must first obtain … the width and height of the screen. … In ncurses, the default output window … is called the standard screen, … which has the same size as the terminal window. … And in this exercise file, … the size is obtained by the getmaxyx function … at line 10, then output at line 11. … Now be aware that the variables … height and width are not pointers in this function. … I've already compiled and built the program … so we'll run. … See what the screen size is for this terminal window. … And it's reporting 22 rows by 89 columns, … which looks about right. … Now this terminal window is a bit smaller, … so you would expect a different result. … I will run the same program, … and ncurses reports 15 rows by 57 columns. … When you know the screen's size, … you can safely relocate the cursor … to any position on the standard screen. … The top, left corner of the standard screen …
- Finding, installing, and linking libraries
- Accessing and generating XML data
- Working with JSON
- Working with the libcurl library
- Text programming
- Reading, writing, and manipulating JPEG images
- Working with PNG images
Skill Level Advanced
1. Setup and Configuration
2. Data Structures
3. Web Access
4. Text Programming
5. Computer Graphics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.