Where is the <conio.h> header file on Linux? Why can't I find <conio.h>?

janniks picture janniks · Jan 9, 2012 · Viewed 281.4k times · Source

Possible Duplicate:
How to implement getch() function of C in Linux?

What is the equivalent Linux version of the conio.h header file from MS-DOS?

Is there a way to replace its functionality? e.g. getch()

I'm using gcc and the text editor Geany to compile C code.

Answer

Sangeeth Saravanaraj picture Sangeeth Saravanaraj · Jan 9, 2012

conio.h is a C header file used in old MS-DOS compilers to create text user interfaces. Compilers that targeted non-DOS operating systems, such as Linux, Win32 and OS/2, provided different implementations of these functions.

The #include <curses.h> will give you almost all the functionalities that was provided in conio.h

nucurses need to be installed at the first place

In deb based Distros use

sudo apt-get install libncurses5-dev libncursesw5-dev

And in rpm based distros use

sudo yum install ncurses-devel ncurses

For getch() class of functions, you can try this