How do we compare a end-of-line character '\n' with a string?
<p>I wanted to know how I can compare a end-of-line character '\n' with a string.
I don't really want to use the getline function because it not convenient with me. </p>

<p>My purpose is to increment the number of line each time I reach the end-of-line character '\n' so that each time my file read a word, it would output the line number it is at. </p>

<p>for example if the word "blue" is at line 2 the screen would output line 2
or if the word "common" is at line 4 the screen would output line 4 </p>

<p>thanks,
this is my first time using the site.</p>