All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shriramana Sharma <samjnaa@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: Help: need to prevent infinite loop
Date: Wed, 18 Jan 2006 21:54:36 +0530	[thread overview]
Message-ID: <200601182154.36474.samjnaa@gmail.com> (raw)
In-Reply-To: <43CC996D.4050100@ajp-services.net>

Tuesday, 17 January 2006 12:44 samaye, Jesse Ruffin alekhiit:

> This inelegant, but satisfactory, method fixes the problem:
> 		fgets(buf,12,stdin);

Thanks for your reply and sorry for the delay in mine.

The suggestion to use fgets reminded me of this gcc-generated warning with 
gets:

samjnaa@linux:~/bin/learning> gcc -Wall -o gets gets.c
/tmp/ccA8bxgm.o: In function `main':
gets.c:(.text+0x25): warning: the `gets' function is dangerous and should not 
be used.

Though I did not get such a warning with fgets, I wonder why this function is 
considered dangerous. Could the same problem perhaps apply to fgets too and 
gcc doesn't inform me of it?

-- 

Penguin #395953 resides at http://samvit.org
subsisting on SUSE Linux 10.0 with KDE 3.5

  reply	other threads:[~2006-01-18 16:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-17  4:36 Help: need to prevent infinite loop Shriramana Sharma
2006-01-17  7:14 ` Jesse Ruffin
2006-01-18 16:24   ` Shriramana Sharma [this message]
2006-01-18 16:33     ` Steve Graegert
2006-01-22 10:20   ` Glynn Clements
2006-01-22 11:28     ` Jesse Ruffin
2006-01-23  5:57       ` Jesse Ruffin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200601182154.36474.samjnaa@gmail.com \
    --to=samjnaa@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.