I have the following code:

Code:
            while (lineread != "\n")
            {
                getline(ifs,lineread);
            }
In essence, it reads an input file, line by line until it hits a line only containing a newline character. So if the input text file is:

2 7
GC 0 1 2 3 4 5 6
1 0 290 590 880 1170 - -
2 0 340 680 1020 1360
3 0 390 770 1160 1400
4 0 430 860 1290 1400
5 0 470 940 1400
6 0 510 1010 1400

7 12.5
GC 0 1 2 3 4 5 6
1 0 340 690 1030 1380 - -
2 0 410 820 1230 1630
3 0 470 940 1410 1880
4 0 530 1060 1590 2120
5 0 590 1180 1770 2360
6 0 650 1290 1940 2500
It should exit the while loop after hitting line 6. What happens however is that it goes into a perpetual loop and doesnt exit the while loop upon reading line 6.

What I did was changed the code to:
Code:
            while (lineread != "*")
            {
                getline(ifs,lineread);
            }
and the input file to:
2 7
GC 0 1 2 3 4 5 6
1 0 290 590 880 1170 - -
2 0 340 680 1020 1360
3 0 390 770 1160 1400
4 0 430 860 1290 1400
5 0 470 940 1400
6 0 510 1010 1400
*
7 12.5
GC 0 1 2 3 4 5 6
1 0 340 690 1030 1380 - -
2 0 410 820 1230 1630
3 0 470 940 1410 1880
4 0 530 1060 1590 2120
5 0 590 1180 1770 2360
6 0 650 1290 1940 2500
and finally it stops after line 6. In this case, merely changing the "\n" conditional character to a simple asterisk character "*" fixes the problem.

However I wish to keep the input text file as is with the newlines, so how do I make it exit the while loop when detecting a \n as a line?