从获取键盘输入,而无需等待输入 [英] Get Input from keyboard without waiting for input

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

问题描述

与fgets功能()和残培()将等待用户继续之前输入的输入。我要的是这个功能:
如果用户presses的x可变的将开始递减,'c'的将导致开始递增变量。
问题是,当我试图让输入程序暂停。我希望变量继续递增或递减,并没有冻结,等待用户输入。

Functions like fgets() and getch() will wait for the user to enter input before continuing. What I want is this functionality: If the user presses 'x' a variable will begin decrementing, 'c' will cause the variable to begin incrementing. The problem is the program halts when I try to get input. I want the variable to continue incrementing or decrementing and no 'freezing' while waiting for user input.

我使用Visual Studio 2008,编写C控制台应用程序。

I am using visual studio 2008, writing a c console application.

谢谢!

推荐答案

您需要一个特殊的控制台输入/输出库NCURSES一样或Borland的CONIO做到这一点。不能用标准C库做到这一点。

You need a special CONSOLE INPUT/OUTPUT library like NCURSES or Borland's CONIO to do that. Can't do it with standard C library.

如果专门使用Windows,看一看的 Windows控制台功能的。

If you are using Windows exclusively, take a look at Windows Console Functions.

这篇关于从获取键盘输入,而无需等待输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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