Detecting Keyboard Input without return

Hi,

I need a way to detect the up and down arrow key inputs for my program. I do not want to wait for the return key to be entered(so that rules out getch() and family). Also I need to process several of these inputs in parallel, by servicing each request with a thread.
Is that possible?

-Ravneet

See this post - it allows reading any key as it is pressed, without hitting return.

http://www.unix.com/showthread.php?t=20438&highlight=canonical

I suggest you look up terminal functions such as 'cfmakeraw()'.

Jim,
Two things, firstly I don't want to echo my input on the screen. This seems to do that. Second, I still can't seem to get my output without pressing enter. Another strange thing that I notice is that I need to enter atleast 4 characters (and enter thereafter) to see the output. Does that have to do with stream buffering by any chance? Do I need to set it to unbuffered?

Porter,
I looked up the termios library function which you have suggested. While tcsetattr and tcgetattr seem to work fine, I get a symbol reference error for cfmakeraw. However I tried by directly doing what cfmakeraw does, and that also does not solve my problem.

We have a search function on this site. Look what I found when I tried searching for "termios".