retiring gets(3)

Leslie Mikesell les at chinet.chi.il.us
Fri Nov 11 14:23:38 AEST 1988


In article <9054 at ihlpb.ATT.COM> gregg at ihlpb.ATT.COM (Wonderly) writes:

>I believe that the right thing to do is to use a new function called
>nlfgets (str, size, fp), that does exactly as gets(3). 

>....  I have written this exact function many times just to
>have the benefit of no strchr() call.

Same here, but I made it return the number of characters read so that
it can also avoid the strlen() call (which will be incorrect anyway
if there were any nulls in the line).  Why does any function return a
pointer that you obviously already knew?  Seems like it would only
be useful if you wanted to nest function calls and ignore errors. 

Les Mikesell



More information about the Comp.lang.c mailing list