[OCLUG-devel] Re: [OCLUG] how to read an input line ?

Chris Smith cbsmith at gmail.com
Fri Sep 2 15:17:10 PDT 2005


Following up to oclug-devel

On 8/30/05, Joshua Robinson <joshua.robinson at sbcglobal.net> wrote:
> Hi,
> 
> What can I use instead of  gets( buf ) to read a input line ( in C and
> C++ ) ?

You should basically *never* use gets(), as it's an unsafe call.
fgets() is a better way to go, and is basically a more general version
of gets(). There is also the scanf family of functions, but a lot of
those tend to be almost as unsafe as gets().

-- 
Chris


More information about the OCLUG-devel mailing list