The fgets function terminates the line with a null character (\0). Unlike gets, fgets places the new-line character that terminates the input line into the user buffer if more than maxchar characters have not already been fetched. When the file pointed to by file_ptr is opened in record mode, fgets treats the end of a record the same as a new-line character, so it reads up to and including a new-line character or to the end of the record.