key by key unbuffered input on Un*x 
Author Message
 key by key unbuffered input on Un*x

What is the easiest way to read keys as the user types them, without
having to wait for a return? I am looking for a solution that is portable
among eunices.

Is there an easy way to do this?

Thanks,

Joe Laffey
LAFFEY Computer Imaging
St. Louis, MO
http://www.*-*-*.com/
------------------------------
Your mouse has moved.   Windows NT must be restarted for the change to
take effect.   Reboot now?  [ OK ]



Sat, 17 Nov 2001 03:00:00 GMT  
 key by key unbuffered input on Un*x

   What is the easiest way to read keys as the user types them, without
   having to wait for a return?

You can't do that in ANSI C.

   I am looking for a solution that is portable among eunices.

Then you should ask in comp.eunice.programmer, I suppose.
--
"Large amounts of money tend to quench any scruples I might be having."
  -- Stephan Wilms



Sat, 17 Nov 2001 03:00:00 GMT  
 key by key unbuffered input on Un*x
This is in the FAQ, but here is something for you to run with:

Among Unix, the curses library allows you to do such things.  You can also
look at stty settings like raw, uncooked, etc.  stty settings are not always
the same among different flavors of Unix, but they are not too bad overall
to deal with.  I recommend the curses approach.

--
****************************************
Richard Armstrong
State Of The Art Consulting, Inc.
http://www.stateoart.com
****************************************

Quote:
> What is the easiest way to read keys as the user types them, without
> having to wait for a return? I am looking for a solution that is portable
> among eunices.

> Is there an easy way to do this?

> Thanks,

> Joe Laffey
> LAFFEY Computer Imaging
> St. Louis, MO
> http://www.laffeycomputer.com/
> ------------------------------
> Your mouse has moved.   Windows NT must be restarted for the change to
> take effect.   Reboot now?  [ OK ]



Sat, 17 Nov 2001 03:00:00 GMT  
 key by key unbuffered input on Un*x

Quote:

>This is in the FAQ, but here is something for you to run with:

>Among Unix, the curses library allows you to do such things.  You can also
>look at stty settings like raw, uncooked, etc.  stty settings are not always
>the same among different flavors of Unix, but they are not too bad overall
>to deal with.  I recommend the curses approach.

Curses is a lot of overhead just to get the functionality that
can be coded up in about a dozen lines using tcsetattr() and
friends.

  Floyd

--


     North Slope images: <http://www.ptialaska.net/~floyd>



Sun, 18 Nov 2001 03:00:00 GMT  
 key by key unbuffered input on Un*x

Quote:


>> Among Unix, the curses library allows you to do such things.  You can also
>> look at stty settings like raw, uncooked, etc.  stty settings are not always
>> the same among different flavors of Unix, but they are not too bad overall
>> to deal with.  I recommend the curses approach.

> Curses is a lot of overhead just to get the functionality that
> can be coded up in about a dozen lines using tcsetattr() and
> friends.

That's true, but those dozen lines differ wildly among different
versions of Unix (some of which don't have tcsetattr), so they
can be very tricky to get right.  Curses can be much easier to
use, especially if you're a beginner, or uncomfortable using
low-level system calls, or uninterested in writing two or three
versions of the code (and getting all the #ifdefs right).
There are versions of curses for systems other than Unix, too.

We could about as well say that the functions in <stdio.h> have a
lot of overhead just to get the functionality that could be coded
up in a few lines using open(), read(), write(), and friends,
or that a C compiler introduces a lot of overhead just to get
the functionality that could be coded up in assembler, or that
a computer introduces a whole lot of overhead to get the
functionality we could get by counting on our fingers... :-)

                                        Steve Summit



Sun, 18 Nov 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. CDIALOG : respond to PGUP-PGDN key (key input in general)

2. Reading keys keys in a custom control

3. encryption key input

4. Multiple and Simultaneous Key input

5. How to encrypt (RSA) using private key and decrypt using public key

6. Left Shift Key OR Right Shift key is pressed

7. Accepting input from cursor keys...

8. Accepting input from cursor keys...

9. How to read input as arrow keys?

10. Key board input

11. Single Key input without cr

12. F-keys/cursor keys w/curses?

 

 
Powered by phpBB® Forum Software