conio.his notCheader files in the standard library,ISOand thePOSIXThere are no definitions in the standard. Coniois aConsole input/output(console input and output), which defines the functions of data input and data output through the console, mainly by the user by the keyboard-generated corresponding actions, such asgetch ()functions, and so on. MostDOS,Windows,Phar Lap,Dosx,OS/2and other platforms on theCThe compiler provides this file,UNIXand theLinuxPlatform forCThe compiler itself usually does not contain this header file, but already has its Compatibility pack, which can be consulted:
http://conio.sourceforge.net/
In addition, we usually use the mainconio.hin this header file,getch ()function, which reads the keyboard character but does not display it (without Echo), but containsconio.hthe program inLinuxcannot be compiled directly through, becauseLinuxwithout this header file, in addition to using the above compatibility package can also beLinuxusing native methods to achieve the same effect is to useLinuxcommand of the systemStty–echo, it does not display the input content, the source code is as follows.
In Windows
#include <stdio.h>
#include <conio.h>
int main () {
char c;
printf ("Input a char:");
C=getch ();
printf ("You have inputed:%c \ n", c);
return 0;
}
In Linux
#include <stdio.h>
int main () {
char c;
printf ("Input a char:");
System ("Stty-echo");
C=getchar ();
System ("Stty echo");
printf ("You have inputed:%c \ n", c);
return 0;
}