What's so bad about scanf anyway???
Doug Gwyn
gwyn at smoke.brl.mil
Tue Nov 13 00:24:27 AEST 1990
In article <4300 at sactoh0.SAC.CA.US> jak at sactoh0.SAC.CA.US (Jay A. Konigsberg) writes:
>IMHO gets() or getchar() is better for input because the programmer
>has greater control over what is being input. Specifically, if the
>programmer wants a float value and a character is input gets() won't
>error on it, scanf() will. My argument goes mainly to bullet-proofing
>programs.
If you really are concerned about bulletproofing, don't use gets() unless
you have control over the length of the lines being scanned. Use fgets()
instead, if the input comes from some uncontrolled source (like a human).
More information about the Comp.lang.c
mailing list