How do i use file handling to "know" when the enter has been pressed, that is I've arrived at the next line.
I tried something like
1 2 3 4 5 6 7 8 9 10 11 12 13 14
char c = ' ';
while( t--)
{
count = 0;
while( c != '\n' )
{
infile >> a[i++];
c = infile.get(); // get character from file
}
// i need to exit the inner loop after each line
c = 'r';
}
But this doesn't quite work. In the above code the inner loop ( which is supposed to break when i get to the next line) doesn't break till the end of the file. Can someone please help me and tell me fix this or some other way to do it>
Thank you very much.