Search code examples
cansi-escapeconsole-input

Internals of ncurses: console input


How exactly does Ncurses capture input into the console? I would like to implement it myself instead of using ncurses due to the overhead that ncurses is causing.

Thanks!


Solution

  • Very short and basically: It might use the TTY ioctl calls to get and set flags needed for the different modes. Then it could simply use read to read characters in a blocking or non-blocking manner.

    Special keys (like the function keys for example) are read using multiple characters which are parsed.