From the course: Exploring C Libraries

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Exploring ncurses input

Exploring ncurses input - C Tutorial

From the course: Exploring C Libraries

Start my 1-month free trial

Exploring ncurses input

- [Dan Gookin] Standard C input and output is stream-based, meaning that text is read and written differently than most interactive programs you use. With Ncurses however, text input can be interactive. In this exercise file, the getch function, embedded in a while loop at line 14, fetches input as it comes in one character at a time. Now the function automatically echos input to the display foregoing the need for a refresh statement. I've already compiled the length of the codes, so let's see what it does. (instructor typing) Okay, so type some text. (instructor typing) And I'm typing text and it's appearing on the screen exactly as I type it. Now the Enter key acts as a carriage return here, so if you want to go to another line you have to press Ctrl + J and it erases the line, Whatever. Press the Tilde key to quit. For reading strings of text, use the getnstr function appearing in this code at line 13. It's…

Contents