retiring gets(3)

Richard Kennaway CMP RA jrk at s1.sys.uea.ac.uk
Thu Nov 10 22:34:25 AEST 1988



Not being a Real Programmer (tm), I had to look in the Unix manual to see
what the fuss was about.  The gist of the entry for gets(3) is:

	NAME		gets, fgets - get a string from a stream
	SYNOPSIS	char *gets(s)

	gets reads characters from the standard input stream, stdin,
	into  the  array pointed to by s, until a new-line character
	is read or an end-of-file  condition  is  encountered.

In other words, gets will read an *arbitrarily large* amount of data from
the file and place it in memory, beginning at &(s[0]).  Presumably the
programmer must guess a suitable amount of memory to allocate for s, then
pray that no-one ever runs his program on a file with very long lines.

Words fail me.



More information about the Comp.lang.c mailing list