char* fgets

char* fgets(char *__str, int __size, FILE *__stream)

Read at most size - 1 bytes from stream, until a newline character was encountered, and store the characters in the buffer pointed to by str. Unless an error was encountered while reading, the string will then be terminated with a NUL character.

If an error was encountered, the function returns NULL and sets the error flag of stream, which can be tested using ferror(). Otherwise, a pointer to the string will be returned.