home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!unixland!wellspring!elliot
- From: elliot@Wellspring.COM (Elliot H. Mednick)
- Newsgroups: comp.os.msdos.programmer
- Subject: Keyboard input processing -- rolling one's own?
- Distribution: world
- Message-ID: <715029154snx@Wellspring.COM>
- Date: Fri, 28 Aug 92 19:12:34 GMT
- Organization: Wellspring Solutions, Sutton, MA.
- Reply-To: elliot@Wellspring.COM
- Lines: 23
-
- An application that I am developing requires a more sophisticated keyboard
- input processing than getc() can provide. getc (stdin) returns only
- when a crlf is detected.
-
- I need (to write) a routine that returns either at the end of a line
- or if the _first_ character typed is a specified "hot key" (e.g. a
- function key). As a side-effect, I need each key pressed to echo to
- stdout and also to tee into a file (for a keystroke saver).
-
- I would like this routine to handle file streams, as well (without the
- "hot key" detection).
-
- In Borland C++ (3.0) and MSC, there is a routine called getch which
- gets a character directly from the console. I can use this and
- isatty() to write my own getc that does what I want. The problem is,
- I would like to attempt to make this routine portable to other
- compilers and to UN*X; i.e. using ANSIC or C++ constructs only.
- getch() is _not_ ANSI.
-
- Is this possible?
-
- Thanks in advance.
- -Elliot
-