English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories
0

What can you use so that users can enter input, but the program doesn't stop and wait for the to do so?

2006-12-26 04:47:06 · 3 answers · asked by jeremydashiell 1 in Computers & Internet Programming & Design

3 answers

Okay, this is a type of programming function that you create, not one that exists already. Think about it, all the basic input keywords will wait for input to happen without limitations. The reason for this is obvious, since if the program goes on to the next statement it would take such a short time to process the input statements that you'd never be able to intentionally hit the window of oppurtunity.

To create a function that will do this sort of thing(called polling), you must create a loop that will wait in a ready state until input is sensed or until a certain time is elapsed. Without giving the exact code, you'll need to find a keyword in Pascal that simply looks to see if the keyboard's state has changed and returns a specific result if it has.

Then you can use this test of keyboard status to write your polling loop.

I hope that this helps you understand what you need to do and gives you enough information to find your specific answer.

2006-12-26 05:06:33 · answer #1 · answered by Anonymous · 0 0

You would use "keypressed". As in

repeat
repeat
blahblahblah
until keypressed;
read(kbd,asdf);
until blahblahblah;

and voila, of course it largely depends on what ur trying to do, but this setup would allow you to havea program looping over and over again and if the user presses something it will get read at the end of the next loop. Even if the user presses it really quickly it will still be saved in the keyboard buffer so it is not a problem.

2006-12-26 07:18:42 · answer #2 · answered by Anonymous · 0 0

You can use readln, doesn't it work?

2006-12-26 04:55:24 · answer #3 · answered by c_y_t_y 2 · 0 1

fedest.com, questions and answers