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