How to get a getch( )

Bummer, your small c apps compiler doesn’t have a getch().

We can overcome this by installing ncurses or create our own getch() function.

  • ncurses

If you’re using cygwin, we should install ncurses first (it’s not included in cygwin’s default setup). First of all, you have toĀ get libncurses-devel package.

Here is example how to use ncurses

Manual compile: gcc test_ncurses.c -lncurses

CMake example to compile

  • Here is the solution for creating getch() function.

Have fun.

Advertisements