NAME
gets, fgets - get a string from a stream
SYNOPSIS
#include <stdio_p.h>
char *gets (s)
char *s;
char *fgets (s, n, stream)
char *s;
int n;
FILE *stream;
DESCRIPTION
gets
reads a string into
s
from the standard input stream
stdin.
The string is teminated by a new-line character, which is replaced in
s
by a null character.
gets
returns its argument.
fgets
reads n-1 characters, or up to a new-line character (which is retained),
whichever comes first, from the
stream
into the string
s.
The last character read into
s
is followed by a null character.
fgets
returns its first argument.
SEE ALSO
ferror(3P)
,
fopen(3P)
,
fread(3P)
,
getc(3P)
,
puts(3P)
,
scanf(3P).
DIAGNOSTICS
gets
and
fgets
return the constant pointer NULL upon end-of-file of error.
NOTE
gets
deletes the new-line ending its input, but
fgets
keeps it.