retiring gets(3)

Jim Shankland jas at ernie.Berkeley.EDU
Mon Nov 21 09:29:00 AEST 1988


In article <8915 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
[In effect:  sometimes gets() really is safe, or sufficient:  e.g., in programs
whose input is known a priori, or in small, one-shot test programs, or ....]

>Why work harder when gets() does exactly what one needs?

But how much harder do you end up working without gets()?  Using fgets()
isn't exactly 5 years of hard labor.  gets() just doesn't seem to
provide much added value, and is almost never safe.  (I've certainly
written some small, one-shot test programs that ended up being so useful
that lots of people had the opportunity to gag at my "one-shot" code.)

Jim



More information about the Comp.lang.c mailing list