p6.3.c

来自「播放WMV的音频程序」· C语言 代码 · 共 53 行

C
53
字号
#include <stdio.h>#include <stdlib.h>#include <curses.h>#include <unistd.h> void init(){   initscr();   cbreak();   nl();   noecho();   intrflush(stdscr,FALSE);   keypad(stdscr,TRUE);   refresh();} int getpasswd(char* passwd, int size){   int c;   int n = 0;      printw("Please Input password:");   do{      c = getch();      if (c != '\n'){         echochar('*');//printw("*");         passwd[n++] = c;        }   }while(c != '\n' && n < (size - 1));   passwd[n] = '\0';    return n;} int main(){   char passwd[20];   int n;      init();   n=getpasswd(passwd, sizeof(passwd));      printw("\nYour passwd is:%s\n", passwd);   printw("Press any key continue ...\n");      refresh();   getchar();   endwin();   return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?