--- In [email protected], "Brett McCoy" <[EMAIL PROTECTED]> wrote:
>
> On Sun, Jun 8, 2008 at 12:58 PM, Bill Cunningham <[EMAIL PROTECTED]> wrote:
> 
> >   You have to watch for buffer overflow though. I wouldn't use gets()
> > that's why I used fgets redirected to stdin.
> 
> Absolutely correct. Even the Unix man page for gets says to never
use it.

And if you compile a program which uses it with gcc, you get:

warning: the `gets' function is dangerous and should not be used.

But don't forget that unlike gets(), fgets() adds a \n to the end of
the input (before the \0).

Reply via email to