The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to get capture input events from keyboard and mouse yhacks High Level Programming 4 05-26-2008 04:31 AM
Keyboard Input cpaquette High Level Programming 4 04-07-2008 10:44 AM
Don't show keyboard input on terminal marianor31 Shell Programming and Scripting 1 03-23-2007 03:54 PM
suppressing keyboard input anthreedhr Shell Programming and Scripting 1 10-21-2004 08:05 AM
How can I map Unix keyboard for PC keyboard simhab UNIX for Advanced & Expert Users 1 03-06-2002 08:29 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-09-2007
Registered User
 

Join Date: Sep 2005
Posts: 6
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
Reply With Quote
Forum Sponsor
  #2  
Old 05-09-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,274
See this post - it allows reading any key as it is pressed, without hitting return.

unbuffered streams.
Reply With Quote
  #3  
Old 05-09-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
I suggest you look up terminal functions such as 'cfmakeraw()'.
Reply With Quote
  #4  
Old 05-10-2007
Registered User
 

Join Date: Sep 2005
Posts: 6
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.
Reply With Quote
  #5  
Old 05-10-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
Quote:
Originally Posted by ravneetd
I looked up the termios library function which you have suggested.
We have a search function on this site. Look what I found when I tried searching for "termios".
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0