GetsFgetsinput a string
#include <stdio.h>
char *getschar *schar *fgetschar *sint nFILE *fpDescription
Fgets reads characters from the file "fp" and places them in
the buffer pointed to by "s" up to a carriage return ('\n') but
not more than "n" - 1 characters. A null character is appended
to the end of the string.
Gets is similar to fgets, but gets is applied to "stdin" and no
maximum is stipulated and '\n' is replaced by a null.
Both functions return their first arguments.
Caveats
The different treatment of the "\n" by these functions is
retained here for portability reasons.
Diagnostics
Both functions return NULL on end-of-file or error.
See Also
puts(),
getc(),
scanf(),
fread()