The functions fgets() reads up to n-1 characters from the input stream referenced by fp.It copies the read string into the buffer buf,appending a null character to terminate the string.
If this function encounters a new line character Nn or the end of the file EOF before they have read the maximum number of characters, then it returns the characters read up to that point including the new line character. You can also use int fscanf(FILE*fp, const char format, function to read strings from a file, but it stops reading after encountering the first space character