home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!gatech!destroyer!news.iastate.edu!pv0321.vincent.iastate.edu!dschmitz
- From: dschmitz@iastate.edu (Daniel C Schmitz)
- Subject: Re: ** Ack! Help again! **
- Message-ID: <dschmitz.726261452@pv0321.vincent.iastate.edu>
- Sender: news@news.iastate.edu (USENET News System)
- Organization: Iowa State University, Ames IA
- References: <kaNTwB1w165w@tradent.wimsey.bc.ca>
- Date: Tue, 5 Jan 1993 19:17:32 GMT
- Lines: 25
-
- In <kaNTwB1w165w@tradent.wimsey.bc.ca> lord@tradent.wimsey.bc.ca (Jason Cooper) writes:
-
- >time I use scanf or gets, and I ask for more than one input of a string
- >in a row, like this:
- >gets(string1)
- >gets(string2)
- >or however that works (the point being they are seperate lines), C will
- >skip some of the inputs for apparently no reason at all.
-
- I have often had problems with scanf followed by a gets. The first gets
- that follows any series scanf's always returns an empty string.
- A hack that has worked for me on some systems is to put a dummy gets between
- scanf's and gets's.
-
- scanf(...)
- scanf(...)
- gets(..) /* this is a dummy, to fix problems that I've experienced */
- get(...) /* legitimate gets, use the results */
- scanf(...)
- gets(...) /* dummy */
- gets(...) /* useful value */
-
- dschmitz
- dschmitz@iastate.edu
-
-