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