#include <stdio.h> #include <conio.h> #include"getpasswd.h" char passwd[12] = ""; char *getpasswd() { char c; int i = 0; while ((c=getch()) != ‘\r‘) { if(c==8) i--; else { passwd[i++] = c; putchar(‘*‘); } } passwd[i] = ‘\0‘; return passwd; }
时间: 2024-10-08 06:47:11