Reading single character in linux [Archive] - C Board

PDA

View Full Version : Reading single character in linux


aurumice
03-01-2002, 02:05 AM
In linux...how can my c program get a single character from a keyboard without hitting 'Enter'(newline)???

rohit
03-01-2002, 02:26 AM
getchar,getche, getch functions i think can do that ...

Salem
03-01-2002, 09:10 AM
You have to make stdin unbuffered

Try
setbuf
setvbuf

Or looking at termios

klausi
03-03-2002, 11:53 AM
getch() , getche() arenīt ANSII-conform!!

klausi

PutoAmo
03-03-2002, 01:21 PM
You have to go into noncanonical mode. default is canonical