Synopsis
#include <stdio.h>
char *gets(char *s);
Description

gets reads characters from standard input into the array pointed to by s until end-of-file is encountered or a new-line character is read. Any new-line character is discarded, and a null character is written immediately after the last character read into the array.

gets returns s if successful. If end-of-file is encountered and no characters have been read into the array, the contents of the array remain unchanged and gets returns a null pointer. If a read error occurs during the operation, the array contents are indeterminate and gets returns a null pointer.

Portability

gets conforms to ISO/IEC 9899:1990 (C90) and ISO/IEC 9899:1999 (C99).

See also

getchar