[LBo] c/c++ one keystroke input without waiting for "Enter"

Loren Lockwood lockwoodlo at cantv.net
Mon Feb 19 14:53:09 CET 2007


Hi all.  I have been trying to help my son with his computer science 
courses.  The teachers all use MS software for programming, but I won't 
have it on my computer.  His own computer runs XP, with Borland c++ as a 
programming platform.

With the MS conio routines it is easy to get a key and analyze it, 
without the user's hitting "Enter" first.  Does anybody know how to use 
ANSI c or c++ to get a single keystroke from the keyboard without 
waiting for the user to press "Enter"?  I have examined the iostream 
classes but can't find anything which allows this.  I could instantiate 
a new istream (or ifstream) object, but I don't know how to get it to 
receive input from the keyboard.

Help will be GREATLY appreciated.  I have worked on this for quite a while.

-- 
Ol' Gramps



More information about the QnA mailing list