ANSI C无回声键盘输入 [英] ANSI C No-echo keyboard input

查看:126
本文介绍了ANSI C无回声键盘输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在谷歌上搜索周围没有运气。得到()我正在寻找一个方式做GETC()或或任何不回显到终端。只见的kbhit(),但这并不显得ANSI的一部分。理想情况下,我想code,看起来像

I've been Googling around with no luck. I'm looking for a way to do getc() or gets() or whatever that does not echo to the terminal. I saw kbhit() but this doesn't appear to be part of ANSI. Ideally, I'd like code that looks like

char s[100];
no_echo_gets(s); /* Won't echo to screen while being typed */
printf("%s\n", s);

是否有人知道一个很好的ANSI标准的方式做到这一点?

Does anybody know a good ANSI compliant way to do this?

推荐答案

您无法使用ANSI C.做在一个跨平台的方式,您将不得不使用一些特定的OS-code,或使用库如 ncurses的

You can't do it in a cross-platform manner using ANSI C. You'll have to use some OS-specific code, or use a library such as ncurses.

这篇关于ANSI C无回声键盘输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆