Read character from keyboard

A

André Wagner

Hello,

I wonder if it's possible to read a character from the keyboard
without pressing enter...

Thank you in advance,

André
 
N

nobu.nokada

Hi,

At Wed, 13 Aug 2003 05:18:50 +0900,
André Wagner said:
I wonder if it's possible to read a character from the keyboard
without pressing enter...

It is completely system dependent issue. Which platform do you
use?

On Unixes, you can disable tty input canononical mode or
setting it raw mode, and read 1 byte.
 
A

Alan Davies

I've been trying to do something similar. It would appear that there is
a bug in the windows implementation of gets which causes it to block the
entire process instead of the thread.
 
J

Jason Williams

What I'm trying to write is a server on which you can type commands
(like a prompt). So I would have two threads: one for the server
processing (the socket) and another one for the prompt. The problem is
that the socket thread won't write anything on the screen (like a
warning message) if the prompt thread is waiting for a input.

One way might be to use "select" on your socket and stdin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top