I'm trying to write a program that reads a text file and displays the first ten lines. The way I'm trying to do this is with a loop that reads a character at a time from a file and within that loop I'd like it to keep track of the number of times the input character is '\n' and increment a variable that counts the lines and when the line count reaches 10, it closes the file and exits the loop. I'm not exactly sure how to do that. I'd like some example to get an idea what to do.