retiring gets(3)

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Nov 10 12:56:58 AEST 1988


In article <1031 at cps3xx.UUCP> usenet at cps3xx.UUCP (Usenet file owner) writes:
>This may be a naive question, or perhaps I haven't followed the right
>stories, but what is the problem with using gets versus fgets?

If you don't know for sure that the input line will fit the buffer
you've allocated for it, gets() can overrun the buffer (with random
consequences).  However, if your program can be sure that the line
will fit, there is nothing wrong with using gets().



More information about the Comp.lang.c mailing list