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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s