Re: A89: Delays, how do you create them
[Prev][Next][Index][Thread]
Re: A89: Delays, how do you create them
On Sunday 18 February 2001 16:06, you wrote:
> so in other words doing this:
>
> while(!ngetchx())
> {
> }//end while
>
> is the same as doing this:
>
> ngetchx();
Yes, the problem is, when the ngetchx function is executed, it takes control
and nothing else happens until it has finished. This is just like any other
function, of course, but ngetchx takes a really long time to finish (it sits
and waits until a button has been pressed). It doesn't matter if you put it
inside a while loop or whatever, it still gets called and it still waits and
prevents your program from continuing. kbhit returns immediately even if no
button has been pressed, and your program continues. In this case, your
program would just call kbhit again and again until a key had been pressed.
James Darpinian
References: