home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / msdos / programm / 8865 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  1.3 KB

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