GETS(3S) DOMAIN/IX Reference Manual (SYS5) GETS(3S)
NAME
gets, fgets - get a string from a stream
USAGE
#include <stdio.h>
char *gets (s)
char *s;
char *fgets (s, n, stream)
char *s;
int n;
FILE *stream;
DESCRIPTION
Gets reads characters from the standard input stream, stdin,
into the array that s points to, until it reaches a newline
character or an end-of-file. The newline character is dis-
carded and the string is terminated with a null character.
Fgets reads characters from the stream into the array
pointed to by s, until n-1 characters are read, or a new-
line character is read and transferred to s, or an end-of-
file condition is encountered. The string is then ter-
minated with a null character.
DIAGNOSTICS
If the function reaches EOF and has not read any characters,
no characters are transferred to s and a NULL pointer is
returned. A NULL pointer is also returned if a read error
occurs, e.g., if you try to use these functions on a file
that has not been opened for reading. In all other cases, s
is returned.
RELATED INFORMATION
ferror(3S), fopen(3S), fread(3S), getc(3S), scanf(3S)
Printed 5/10/85 GETS-1