In the Linux system coding C language Program of the code farm should know, its and in Windows programming is very different, there is not many Linux under Windows commonly used header files, but there are many windows do not have a header file, for beginners, there is a certain restrictive, For example, conio.h header file, there are many functions we often use, so we in the windows under a small system, the common login link can not be used under Linux, today, I will help you solve this problem.
1 #include <stdio.h>
2 Char getch ()
3 {
4 char C;
5 System ("Stty-echo");
6 System ("Stty-icanon");
7 C=getchar ();
8 System ("Stty Icanon");
9 System ("Stty echo");
Ten return C;
11}
void Main ()
13 {
int i;
(+ char a[21];
-Char ch;
+ printf ("Please enter password:");
for (i=0;i<20;i++)
19 {
Ch=getch ();
if (ch== ' \ n ')
22 {
a[i]= ' + ';
break;
25}
Putchar (' * ');
A[i]=ch;
28}
if (i==20)
"A[20]=";
printf ("%s\n", a);
32}
Password input solution under Linux console