home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16201 < prev    next >
Encoding:
Text File  |  1992-11-09  |  1023 b   |  35 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.th-darmstadt.de!rbg.informatik.th-darmstadt.de!misar
  3. From: misar@rbg.informatik.th-darmstadt.de (walter misar)
  4. Subject: Re: >>>> * Get keypress * <<<<
  5. Sender: news@news.th-darmstadt.de (The News System)
  6. Message-ID: <1992Nov9.105147@rbg.informatik.th-darmstadt.de>
  7. Date: Mon, 9 Nov 1992 09:51:47 GMT
  8. References:  <1992Nov7.154748.24501@alf.uib.no>
  9. Nntp-Posting-Host: rbhp64.rbg.informatik.th-darmstadt.de
  10. Organization: TU Darmstadt
  11. Lines: 22
  12.  
  13. In article <1992Nov7.154748.24501@alf.uib.no>, singg@alf.uib.no (Kurt George Gjerde) writes:
  14. >    How do I read a keypress (char) without having the user to 
  15. >    press Return??
  16. >    System = Unix V.
  17. Hm, set the terminal to raw mode, on HP-UX it will look like this:
  18.  
  19. #include <sgtty.h>
  20. ...
  21. { char buf[1];
  22.   struct sgttyb *ttyio;
  23.  
  24.   gtty(0,ttyio);
  25.   (ttyio->sg_flags)|=(RAW); 
  26.   stty(0,ttyio);
  27.   ...
  28.   read(0,buf,1);    /* read one char, don't wait for return */
  29.   ...
  30. }
  31.  
  32. Walter
  33.