home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / std / c / 2968 < prev    next >
Encoding:
Text File  |  1992-11-05  |  1.2 KB  |  32 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!cs.utexas.edu!torn!utzoo!telly!druid!pseudo!mjn
  3. From: mjn@pseudo.uucp (Murray Nesbitt)
  4. Subject: Re: is fflush(stdin) conformant???
  5. Organization: Private system in Toronto, ON
  6. Date: Thu, 5 Nov 1992 11:02:41 GMT
  7. Message-ID: <MJN.92Nov5030241@pseudo.uucp>
  8. In-Reply-To: mgk@sql.sybase.com's message of 2 Nov 92 21:18:55 GMT
  9. References: <MGK.92Nov2131855@cedar.sql.sybase.com>
  10. Sender: mjn@pseudo.uucp (Murray Nesbitt)
  11. Lines: 19
  12.  
  13.  
  14. mgk@sql.sybase.com (Michael Keirnan aka Joe Cool) writes:
  15.  
  16. >I am not actually comtemplating using this construct. A coworker is
  17. >enrolled in a course where the instructor has advised flushing stdin
  18. >(yes, stdin) in conjunction with using scanf() to "flush the unwanted
  19. >newline." This seemed rather odd to me, but hey, what do I know?
  20. >So what sayeth the gospel on the subject?
  21.  
  22. fflush()ing an input stream has no defined effect in ANSI C - it is
  23. intended for output streams or update streams (in which the most
  24. recent I/O operation was not input) only.
  25.  
  26. It may "flush the unwanted newline" on some particular systems, but if
  27. the instructor claims it is a universal way of doing this in C, she's
  28. wrong.
  29.  
  30. -- 
  31. Murray
  32.