home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!jabaru.cec.edu.au!csource!gateway
- From: John.Gibney@f386.n632.z3.fidonet.org (John Gibney)
- Newsgroups: comp.lang.c
- Subject: Re: user input for inter
- Message-ID: <724433346.AA01307@csource.oz.au>
- Date: Sat, 12 Dec 1992 16:50:06
- Sender: gateway@csource.oz.au
- Lines: 28
-
- -=> Quoting Ejh@khonshu.colorado.edu to All <=-
-
- Ej> From: ejh@khonshu.colorado.edu (Edward J. Hartnett)
- Ej> Organization: CIRES, University of Colorado
-
- [... text deleted ...]
-
- Ej> One specific C question that I have is what is a good way to read the
- Ej> user input. In FORTRAN I just READ(*,'(a)') whatever, but I hear that
- Ej> I shouldn't use scanf in C. Is that right? What should I use instead?
-
- For simplicity, I tend to use "gets()"... you can then
- process it as a "string"or you can use the functions
- "atoi()" and/or "atof()" to turn it into numbers. The
- formatting, et al with "scanf()" is a pain if the input
- formats don't EXACTLY match... as well as a common error for
- beginning C programmers is to leave out the "&" in "scanf()"
- calls.
-
- Hope this is useful...
-
-
- John :-)
-
- ... The VMS MasterHarper!
- ___ Blue Wave/QWK v2.10
-
- * Origin: Eastern Mail Centre [PEP] OZ. +61-3-725-1621 (3:632/386)
-