我怎么能“偷看”在键盘没有暂停?

问题描述:

像getchar()这样的东西不起作用,因为它等待了输入。

#include< stdio.h>

while(1)

{

if( getchar())/ *如果按任何键就会中断* /

{

休息;

}


/ *很多其他代码在这里* /

}

Something like getchar() doesn''t work, since it "waits" for input.
#include <stdio.h>
while (1)
{
if (getchar()) /* break if any key is pressed */
{
break;
}

/* lot''s of other code goes here */
}

在文章&lt ; f5 ************************** @ posting.google.com&gt ;, Jeffrey Hiess写道:
In article <f5**************************@posting.google.com >, Jeffrey Hiess wrote:
Something像getchar()一样不起作用,因为它等待输入。
Something like getchar() doesn''t work, since it "waits" for input.



阅读此常见问题解答:

http://www.eskimo.com/~scs/C-faq/q19.1.html

-

Andreas K?h?ri


Read this FAQ:

http://www.eskimo.com/~scs/C-faq/q19.1.html
--
Andreas K?h?ri


Andreas Kahari< ak ******* @ freeshell.org>写道:
Andreas Kahari <ak*******@freeshell.org> wrote:
在文章< f5 ************************** @ posting.google中。 com>,Jeffrey Hiess写道:
In article <f5**************************@posting.google.com >, Jeffrey Hiess wrote:
像getchar()这样的东西不起作用,因为它等待了输入。
Something like getchar() doesn''t work, since it "waits" for input.



阅读此常见问题解答:

http://www.eskimo.com/~scs/C-faq/q19.1.html




要OP:以后请交叉发帖,而不是

多发帖子。您的问题已在

alt.comp.lang.learn.c-c ++中得到解答。谢谢。


问候

-

Irrwahn

(ir ***** **@freenet.de)



To OP: in future please cross-post your message instead of
multi-posting. Your question has already been answered in
alt.comp.lang.learn.c-c++. Thank you.

Regards
--
Irrwahn
(ir*******@freenet.de)


在< f5 ************************ **@posting.google.com> je***********@honeywell.com (Jeffrey Hiess)写道:
In <f5**************************@posting.google.com > je***********@honeywell.com (Jeffrey Hiess) writes:
像getchar()这样的东西不起作用,因为它等待输入。
Something like getchar() doesn''t work, since it "waits" for input.




在*发布之前曾经考虑过阅读FAQ *


Dan

-

Dan Pop

DESY Zeuthen,RZ集团

电子邮件: Da ***** @ ifh.de