End Of File (eof) test help
-
i have a program reading data from a text file and display each section to a grid display. i do a EOF test make sure every info has been extract but seem like a infinite loop. int counter = 0; char Char; char Array[100]; ifstream file; file.open("somefile.txt"); do{ file.get(Char); Array[counter] = Char; ++counter; }while(Char != file.EOF()); seem like good but it a infinite loop; any help?
-
i have a program reading data from a text file and display each section to a grid display. i do a EOF test make sure every info has been extract but seem like a infinite loop. int counter = 0; char Char; char Array[100]; ifstream file; file.open("somefile.txt"); do{ file.get(Char); Array[counter] = Char; ++counter; }while(Char != file.EOF()); seem like good but it a infinite loop; any help?
change while(Char != file.EOF()); to while(!file.EOF());
I have lost more blood shaving than on the battlefield - Adolf Hitler
-
change while(Char != file.EOF()); to while(!file.EOF());
I have lost more blood shaving than on the battlefield - Adolf Hitler