NAME
gets — get a
string from a stdin stream
SYNOPSIS
#include <stdio.h> char *gets(char *s);
DESCRIPTION
The gets() function reads bytes from the standard input stream, stdin(3) , into the array pointed to by s , until a newline is read or an end-of-file condition is encountered. Any newline is discarded and a null byte is placed immediately after the last byte read into the array.
The gets() function may mark the st_atime field of the file associated with stream for update. The st_atime field will be marked for update by the first successful execution of fgetc(), fgets(), fread(), getc(), getchar(), gets(), fscanf() or scanf() using stream that returns data not supplied by a prior call to ungetc().
RETURN VALUE
Upon successful completion, gets() returns s . If the stream is at end-of-file, the end-of-file indicator for the stream is set and gets() returns a null pointer. If a read error occurs, the error indicator for the stream is set, gets() returns a null pointer and sets errno to indicate the error.
ERRORS
Refer to fgetc(3) .
EXAMPLES
None.
APPLICATION USAGE
Reading a line that overflows the array pointed to by s causes undefined results. The use of fgets(3) is recommended.
FUTURE DIRECTIONS
None.
SEE ALSO
DERIVATION
Derived from Issue 1 of the SVID.