TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Neil Heller
from: Jasen Betts
date: 2003-05-25 20:04:22
subject: Keyboard questions

Hi Neil.

24-May-03 11:23:00, Neil Heller wrote to All


 NH> I've got a question about getting keyboard input.

 NH> What I want to do is display a constantly-changing image on the
 NH> screen while constantly checking for keyboard input.

 NH> One method that comes to mind is to simultaneously launch two
 NH> asynchronous threads:  one for getting keyboard input and the
 NH> other for displaying on the screen.  Will the thread waiting for
 NH> keyboard input issue a system blocking call thereby halting the
 NH> changing screen display?

 NH> I'll be working in ANSI-standard *nix so I can't use any of the
 NH> neato DOS tricks like checking the keyboard buffer.

there's stuff in the linux programming howto see the LDP

but basically you have to put the stdin into non-blocking mode,
so that attemoptiung to read fron stdin doesn';t block execution until some
characters arrive.  AIR this involves using ioctl()

 NH> Another question I have about *nix keyboard-input routines deals
 NH> with the enter key.  I know that DOS has getch() and getche()
 NH> which get single character keyboard input without the user having
 NH> to press ENTER. Unfortunately, these are specific to Intel
 NH> machines (most of which use DOS related OSes).  Does the *nix
 NH> world have something similar or does the user _always_ need to
 NH> press ENTER after typing keyboard input?

see above - do that and you can use getc() for single characters without
waiting for enter...

 -=> Bye <=-

---
* Origin: Darth Vader sleeps with a Teddywookie. (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.