Original: http://blog.sina.com.cn/s/blog_6a95e00b0100zqvf.html
#include <stdio.h>
#include <conio.h>
void Main () {
Char ch;
for (;;) {
System ("Stty-echo");
ch = getch ();
if (ch==27) break;
if (ch==13)
Continue
Putch (CH);
}
}
The Getch () feature in Linux implementation conio.h
The Getch () feature in the Conio.h header file is sometimes used when writing C programs under Windows, which reads keyboard characters but does not display (without echo)
Later found that the program containing conio.h in Linux could not be compiled through, because Linux does not have this header file, today suddenly found that can be replaced by other methods, posted out
In Windows
#include <stdio.h>
#include <conio.h>
int Mian () {
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;
}
This will do, note: Linux Stty-echo is not to display the meaning of the input content
No conio.h has been resolved under Linux