- 论坛徽章:
- 0
|
#include <curses.h>;
#include <unistd.h>;
#include <stdlib.h>;
#include <string.h>;
int main()
{
char name[64];
char pw[20];
memset (name, 0, sizeof(name));
memset (pw, 0, sizeof(pw));
initscr ();
move (5, 10);
printw ("%s", " lease login:" ;
move (6, 10);
printw ("%s", "name:" ;
getstr (name);
move (7, 10);
printw ("%s", "passwd:" ;
cbreak();
noecho();
int i=0;
while (i++ < 20)
{
pw = getch();
move (7, 10+strlen("passwd:" +i);
if (pw == '\n')
break;
addch ('*');
}
echo();
nocbreak();
move (9, 10);
printw ("name: %s pass: %s", name, pw);
refresh ();
endwin ();
return 0;
} |
|