1. keyboard input using getc(0)
- Posted by Asa <electro.legacy at gm?il?com> May 16, 2008
- 741 views
Hi all, I am finding that after using an expression like "choice = getc(0)" the next time getc(0) is called, it doesn't wait for the keystroke. Something left in the keyboard buffer from the first call? I did search the docs before posting, but couldn't find an answer. Thanks.
2. Re: keyboard input using getc(0)
- Posted by Bernie Ryan <xotron at bluefr?g.co?> May 16, 2008
- 720 views
Asa wrote: > > Hi all, I am finding that after using an expression like "choice = getc(0)" > the next time getc(0) is called, it doesn't wait for the keystroke. Something > > left in the keyboard buffer from the first call? > > I did search the docs before posting, but couldn't find an answer. > > Thanks. Look up wait_key Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
3. Re: keyboard input using getc(0)
- Posted by Jeremy Cowgar <jeremy at c?wgar.c?m> May 16, 2008
- 727 views
Asa wrote: > > Hi all, I am finding that after using an expression like "choice = getc(0)" > the next time getc(0) is called, it doesn't wait for the keystroke. Something > > left in the keyboard buffer from the first call? > > I did search the docs before posting, but couldn't find an answer. > getc() will return multiple codes for special keys. wait_key will translate those for you. -- Jeremy Cowgar http://jeremy.cowgar.com
4. Re: keyboard input using getc(0)
- Posted by Asa <electro.legacy at gmai?.?om> May 16, 2008
- 740 views
I have done that already, but would like to at least know what was up with getc(0)though. Before I switched to wait_key() i was doing this: choice = getc(0) choice = getc(0) the first call would "clear the pipes" and the second, would work as expected :)
5. Re: keyboard input using getc(0)
- Posted by Jeremy Cowgar <jeremy at ?owga?.com> May 16, 2008
- 744 views
Some keys cannot be expressed with only one ASCII code. For instance, F1 on Linux is expressed as 3 ascii codes: 27, 79 and 80. So, using getc(0) would first return 27. The very next call, 79 and again 80. -- Jeremy Cowgar http://jeremy.cowgar.com
6. Re: keyboard input using getc(0)
- Posted by ChrisBurch3 <crylex at gma??.com> May 16, 2008
- 725 views
- Last edited May 17, 2008
Asa wrote: > > Hi all, I am finding that after using an expression like "choice = getc(0)" > the next time getc(0) is called, it doesn't wait for the keystroke. Something > > left in the keyboard buffer from the first call? > > I did search the docs before posting, but couldn't find an answer. > > Thanks. Hi Run this after your getc while get_key() != -1 do end while end procedure or while getc() != -1 do end while end procedure Chris