1 #include<stdio.h> 2 #include<curses.h> 3 #include<stdlib.h> 4 #include<unistd.h> 5 #include<string.h> 6 #define PW_LEN 256 7 #define NAME_LEN 256 8 int main() 9 { 10 initscr(); 11 move(5,10); 12 attron(A_BLINK); 13 printw("%s","hello linux"); 14 attroff(A_BLINK); 15 refresh(); 16 sleep(1); 17 move(8,10); 18 attron(A_BOLD); 19 addstr("hello c/c++"); 20 attroff(A_BOLD); 21 refresh(); 22 sleep(1); 23 move(10,15); 24 attron(A_STANDOUT); 25 printw("%s","test and for fun"); 26 attroff(A_STANDOUT); 27 refresh(); 28 sleep(1); 29 30 int i=0; 31 const char *read_password="test"; 32 char name [NAME_LEN]; 33 char password[PW_LEN]; 34 move(15,15); 35 printw("%s","login:"); 36 while(true) 37 { 38 i=0; 39 move(16,15); 40 printw("%s","user name:"); 41 getstr(name); 42 43 move(17,15); 44 printw("%s","user password:"); 45 refresh(); 46 cbreak(); //非默认输入模式 47 noecho(); //关闭回显功能 48 memset(password,'