cppreference.com > Standard C I/O > fgets fgets Syntax:
      #include <stdio.h>
      char *fgets( char *str, int num, FILE *stream );
The function fgets() reads up to num - 1 characters from the given file stream and dumps them into str. fgets() will stop when it reaches the end of a line, in which case str will be terminated with a newline. If fgets() reaches num - 1 characters or encounters the EOF, str will be null-terminated. fgets() returns str on success, and NULL on an error. Related topics: fputs fscanf gets scanf