cpp/io/c/fgets

Reads at most characters from the given file stream and stores them in the character array pointed to by. Parsing stops if a newline character is found, in which case will contain that newline character, or if end-of-file occurs. If bytes are read and no errors occur, writes a null character at the position immediately after the last character written to.

Return value
on success, null pointer on failure.

If the end-of-file condition is encountered, sets the eof indicator on (see std). This is only a failure if it causes no bytes to be read, in which case a null pointer is returned and the contents of the array pointed to by are not altered (i.e. the first byte is not overwritten with a null character).

If the failure has been caused by some other error, sets the error indicator (see std) on. The contents of the array pointed to by are indeterminate (it may not even be null-terminated).