home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / msdos / programm / 8049 < prev    next >
Encoding:
Text File  |  1992-07-23  |  841 b   |  23 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!sun-barr!ames!agate!linus!linus.mitre.org!truth!jrv
  3. From: jrv@truth.uucp (Vanzandt)
  4. Subject: Re: Borland C++ 3.0 scanf()/gets() bug.
  5. Message-ID: <1992Jul24.113144.12779@linus.mitre.org>
  6. Sender: news@linus.mitre.org (News Service)
  7. Nntp-Posting-Host: truth.mitre.org
  8. Organization: The MITRE Corp., Bedford, Ma.
  9. References: <1992Jul23.181820.29495@unixg.ubc.ca>
  10. Date: Fri, 24 Jul 1992 11:31:44 GMT
  11. Lines: 10
  12.  
  13.  
  14.  
  15. I believe scanf only reads as much of the input as is needed to satisfy
  16. the format string it has.  The subsequent gets reads the rest of the line
  17. (i.e. the \n).  IMHO neither routine should ever be used.  Instead, use
  18. fgets to read a whole line (with protection against overrunning your
  19. buffer), then sscanf to parse it.
  20.  
  21.                - Jim Van Zandt <jrv@mbunix.mitre.org>
  22.  
  23.