密码以*号显示
来源:互联网 发布:网络客服提成方案 编辑:程序博客网 时间:2024/06/05 03:28
- #include<stdio.h>
- #include<termios.h>
- #include<unistd.h>
- #include<assert.h>
- #include<string.h>
- #include <stdlib.h>
- int getch()
- {
- int c=0;
- struct termios org_opts, new_opts;
- int res=0;
- //----- store old settings -----------
- res=tcgetattr(STDIN_FILENO, &org_opts);
- assert(res==0);
- //---- set new terminal parms --------
- memcpy(&new_opts, &org_opts, sizeof(new_opts));
- new_opts.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOKE | ICRNL);
- tcsetattr(STDIN_FILENO, TCSANOW, &new_opts);
- c=getchar();
- //------ restore old settings ---------
- res=tcsetattr(STDIN_FILENO, TCSANOW, &org_opts);
- assert(res==0);
- return c;
- }
- int main()
- {
- int i;
- char *pd = (char *)malloc(sizeof(char) * 128);
- for(i = 0; ; i++)
- {
- pd[i] = getch();
- if(pd[i] == '\n')
- {
- pd[i] = '\0';
- break;
- }
- if(pd[i] == 127) //删除
- {
- printf("\b \b");
- i = i - 2;
- }
- else
- {
- printf("*");
- }
- if(i<0)
- {
- pd[0]='\0';
- }
- }
- printf("\ncode:%s\n",pd);
- return 0;
- }
0 0
- 密码以*号显示
- 以星号显示密码程序!!!!!
- 输入密码以星号显示
- linux回删密码,密码以*显示
- Linux下实现输入密码以星号显示
- 在c里面,输入密码,只显示*。(以示安全?)
- Android EditText中输入值以星号*显示 (密码的实现)
- ionic的切换效果实现——以登录页密码显示隐藏切换为例
- 密码显示
- 显示密码
- 显示密码框密码
- 显示密码,隐藏密码
- C++编程,输入密码时显示*号
- [vc win32 console 模式适用]获取输入的密码,以*显示,并支持退格的函数
- 显示密码和隐藏密码
- markdown以html显示
- 含章节号的题注编号以阿拉伯数字显示
- 输入密码显示**
- Restful API becomes 404 when using the CXF at the same time
- 10年手工测试的迷茫,值得每个人深思
- 对象关系映射基础
- CREELINKS平台_处理器CeCcp资源使用说明(CeCcp的配置与使用)
- 支付宝接入流程---热点问题
- 密码以*号显示
- HttpClient使用详解
- ABAP 开发系列(08): SAP Open SQL
- PHP 分页框架的使用
- Mysql中文乱码
- jquery获取当前月有多少天
- 第一篇博客
- 支持ie8的轮播图
- C# Form1中打开Form2并永远将焦点放在Form2