home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / os2 / programm / 6611 < prev    next >
Encoding:
Text File  |  1992-11-22  |  1.5 KB  |  45 lines

  1. Newsgroups: comp.os.os2.programmer
  2. Path: sparky!uunet!grebyn!daily!richk
  3. From: richk@grebyn.com (Richard Krehbiel)
  4. Subject: Re: getchar() without <enter> in emx gcc?
  5. In-Reply-To: richk@grebyn.com's message of Sat, 21 Nov 1992 15:47:01 GMT
  6. Message-ID: <1992Nov22.190518.5854@grebyn.com>
  7. Lines: 28
  8. Sender: richk@grebyn.com (Richard Krehbiel)
  9. Organization: Grebyn Timesharing
  10. References: <1992Nov21.154701.16804@grebyn.com>
  11. Distribution: usa
  12. Date: Sun, 22 Nov 1992 19:05:18 GMT
  13.  
  14.  
  15. Let me post the answer to my own question:
  16.  
  17. In article <1992Nov21.154701.16804@grebyn.com> richk@grebyn.com (Richard Krehbiel) writes:
  18.  
  19. >   How do you read a single character from the keyboard without requiring
  20. >   hitting ENTER, and without echo?
  21. >
  22. >   Specifically, this is in emx gcc 0.8e.  I'm incuding what I'm trying
  23. >   now, but it doesn't work.  It does in Unix, which I thought the termio
  24. >   interface in emx was supposed to emulate.
  25. >
  26. >           setbuf(stdin, NULL);
  27. >           ioctl(0, TCGETA, &tio);
  28.  
  29. add this->  tio.c_lflag &= ~IDEFAULT;
  30.  
  31. >           tio.c_lflag &= ~(ICANON | ECHO);
  32. >           tio.c_cc[VMIN] = 1;
  33. >           tio.c_cc[VTIME] = 0;
  34. >           tio.c_cc[VEOL] = 0;
  35. >           ioctl(0, TCSETA, &tio);
  36. >
  37. >   After this, characters are still automatically echoed and buffered,
  38. >   etc.
  39.  
  40. I don't know what it means or why it's needed.  I looked at the
  41. patches for emacs and found this, and it worked.
  42. -- 
  43. Richard Krehbiel                                 richk@grebyn.com
  44. OS/2 2.0 will do for me until AmigaDOS for the 386 comes along...
  45.