Why can't I find <conio.h> on Linux?
Possible duplicate:
How to implement getch () function for C on Linux?
I searched the Linux version of the conio.h header file, but could not find ...
I use gcc and a Geany text editor to compile my C code.
Is there any way to replace its functions? For example, getch()
thank
conio.h is the C header file used by older MS-DOS compilers to create text-based user interfaces. Compilers oriented towards non-DOS operating systems such as Linux, Win32, and OS / 2 provided various implementations of these functions.
#include <curses.h> will provide you with almost all the functions that were provided in conio.h
nuclei should be installed first
In used debros distros use
sudo apt-get install libncurses5-dev libncursesw5-dev
And in rpm based distributions use
sudo yum install ncurses-devel ncurses
For the getch() function class, you can try this
The original conio.h was implemented by Borland, so it is not part of the C standard library and is not defined by POSIX.
But here is an implementation for Linux that uses ncurses to do the job.
A popular Linux library with similar functionality will be ncurses .
This is because it does not exist because it is limited to Windows.
Instead, use standard <stdio.h> functions, such as getc
The recommended ncurses library is good if you want to write console GUIs, but I don't think this is what you want.