home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18483 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.5 KB  |  37 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!wirzeniu
  3. From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
  4. Subject: Re: unbuffered getchar().
  5. Message-ID: <1992Dec16.193406.22563@klaava.Helsinki.FI>
  6. Organization: University of Helsinki
  7. References: <adesai.724348776@class1.iastate.edu>
  8. Date: Wed, 16 Dec 1992 19:34:06 GMT
  9. Lines: 26
  10.  
  11. adesai@iastate.edu (Alpaa Desai) writes:
  12. >A while ago some one had asked if there was a way to get unbuffered
  13. >getchar().  I saw a couple of solutions for it which were I thought a
  14. >bit complicated.  Anyway, I found a simple one in Kernighan and
  15. >Ritchie (second edition) page171.  They have given the entire
  16. >function getchar().
  17.  
  18. Actually, no.  They have written a function that works somewhat like
  19. getchar, some of the time, and have even called it getchar (stupid,
  20. IMHO), but it is not the real getchar.  
  21.  
  22. Even so, the function they have does not solve the problem that most
  23. people are having, since it doesn't disable the operating system's
  24. buffer, only stdio's, and that is required for the effect of reading
  25. single characters without the user having to press return.
  26.  
  27. (Their getchar doesn't mix very well with stdio functions precisely
  28. because it avoid stdio's buffers.)
  29.  
  30. Also not that their implementation is for Unix, not a generic one.
  31. The problem of reading-without-pressing-return stays unsolved (or at
  32. least the solutions are specific to systems).
  33.  
  34. --
  35. Lars.Wirzenius@helsinki.fi  (finger wirzeniu@klaava.helsinki.fi)
  36.    MS-DOS, you can't live with it, you can live without it.
  37.