Re: Still stuck in an infinite loop
- Posted by Travis Beaty <travisbeaty at arn.net> May 18, 2001
- 404 views
Howdy, David! What you may want to do is scan the keyboard buffer at some point in each loop and make sure the user hasn't mashed a button. For instance, you could do this ... procedure killProggieNow() -- Did the user press a key? If not, exit the procedure. if get_key() = -1 then return end if -- User must have pressed a key. Do stuff to shut down program nicely abort(0) end procedure And then, somewhere in each of the loops, put in a call to the above function. If you've only got a couple of loops to monitor, then it would be better to just insert the function's code into the loop (inlining it), as it would make your program run a tad faster. Hope this helps a little, anyway ... Travis Beaty Claude, Texas.