您的位置:首页 > 运维架构 > Linux

linux 的密码问题 ---不带显示的

2016-11-13 23:21 148 查看
编写源文件:secert.c

[cpp] view
plain copy

print?

#include<stdio.h>

#include<curses.h>

int main()

{

char p[20];

printf("Please Input password:");

initscr();//该函数是启动curses模式,在此是关闭了终端回显,实现密码效果

scanf("%s",p);

endwin();//该函数是关闭curses模式。在此即恢复终端回显

printf("Your password is:%s\n",p);

return 0;

}

编译:gcc secret.c -o secret -lcurses
执行:./secret



输入密码后,按回车

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  密码