home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / minix / 4921 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.3 KB  |  36 lines

  1. Newsgroups: comp.os.minix
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!udel!louie!minix
  3. From: henrik@husc.harvard.edu
  4. Subject: A "stupid question"
  5. Message-ID: <1992Dec15.012421.5893@udel.edu>
  6. Originator: mmdf@louie.udel.edu
  7. Sender: usenet@udel.edu (USENET News Service)
  8. Nntp-Posting-Host: louie.udel.edu
  9. Organization: University of Delaware
  10. Date: Tue, 15 Dec 1992 01:23:56 GMT
  11. Approved: usenet=relay@louie.udel.EDU
  12. Lines: 22
  13.  
  14.  
  15. Your problem isn't with getchar() at all, but with that fact that Unix/Minix
  16. do something that is normally very useful - line-buffering.  Essentailly, 
  17. the OS reads the characters you type and saves them up until you type <CR>
  18. or <EOF>, at which time they are forwarded, all at once, to your program (this
  19. is called "cooked" mode).
  20.  
  21. There is a call you can make to change this behavior, however, so that
  22. you can read characters one at a time (by using either "cbreak" or "raw"
  23. modes).  The manual page for the stty command will explain in more detail
  24. what these various modes do and their limitations.
  25.  
  26. Then you should look at the manual page for the ioctl() system call, 
  27. and the manual page for the tty interface, which will tell you what to 
  28. pass to ioctl() to get it to do what you want.
  29.  
  30. Good luck.
  31.  
  32.                     larry...
  33.  
  34. -- 
  35. Mail System (MMDF)
  36.