R
Richard
Keith Thompson said:It doesn't exist, and it's entirely possible that it never will.
I should take a closer look at Richard Heathfield's fgetline(); I
think it already does exactly what I'm suggesting ggets should be
extended to do. But it's a bit more complex to use.
http://www.securityfocus.com/infocus/1412
An informative article.
Might be interesting to people still intrigued by the never ending
gets() debates and home made alternative comparisons.
The libsafe library has moved, but most people use fgets()
anyway. It's new place is here:
http://www.research.avayalabs.com/g...er=LabsProjectDetails&View=LabsProjectDetails
or
http://tinyurl.com/y2b88a
My own take is that "safe" routines such as this ggets should not be
used unless you know exactly what you are doing. Stuff like this can
hide a lot of errors. A good C programmer programs within certain
parameters and limits and this constant worrying about never ending
input streams is hardly ever an issue in the hundreds of programs I have
dealt with. Yes, I must be careful. Yes, I must know the lengths being
pass around. No, I rarely provide the ability for a "never ending" input
to be passed to certain streams. It has always been and will continue to
be so, relatively trivial to read input based on a fixed buffer using
fgets or the equivalent and deal with it at the time. Stuff like this
ggets is no more than a shallow attempt to enforce sloppiness IMO - it
reminds me of C++ and the template libraries:-;