TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Neil Heller
from: Jasen Betts
date: 2003-06-01 20:21:28
subject: Keyboard questions

Hi Neil.

31-May-03 08:43:04, Neil Heller wrote to Jasen Betts


 JB>> ypu asked about asynchronous keyboard (IE not waitong for keys)
 JB>> and raw mode (no line editing, or echo)

 JB>> here's a little demo prog I cooked up with lots of help from the
 JB>> on-line documentation.

 NH> I appreciate all the help that I can get.  Thank you.

It was a learning experience for me... you've missed out a few dead ends
and another peice of code that works differently but only once per login :(
I can't figure out what's wrong with it... (I guess I'm assuming something
in the init/deinit code but can't figure out what)

 NH> What are these two?  I've never heard of them.
 JB>> #include 

EXIT_SUCCESS  STDIN_FILENO other unix constants
it's basically the unix analogue of dos.h

 JB>> #include 

termio functions and constants  IIRC  (I just copies tyhem from man-pages
and example code

 NH> Also, the idea about having all keyboard input done in a thread
 NH> works like a charm.

not my idea there... I'm still scared of threads
can you post example code?

 NH> The blocking only affects the thread, not the
 NH> other parts of the program.  However, the user must still press
 NH> ENTER.

The bit that uses termios turns off that feature.
but don't use stdin (FILE* type stream) based functions as they're
buffered, use read() directly on STDIN_FILENO  (or 0 if you're feeling
lazy)

 -=> Bye <=-

---
* Origin: One less than the checksum of "Jasen Betts" (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™.