Difference between fgets and gets

U

user923005

whilst I don't think Chuck added much with his comment I'd rather
newbie programmers walked around with the idea in their heads "gets is
impossible
to use safely" than the potentially dangerous "gets is nearly
impossible to
use safely".

I'm curious, have you ever written a program that ran in such a
"marshalled"
environment that used gets() safely. And why didn't you use fgets()?

I like Jack's getsafe(). It's not perfect, but it is a lot safer than
gets() and it is not more difficult to use than gets():
http://home.att.net/~jackklein/ctips01.html#safe_gets
 
R

Richard Bos

user923005 said:
I was referring to this (hypothetical and iffy case):

Highly iffy; it presumes that you have full control over your execution
environment, which requires the aforementioned constrictive leatherwork.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top