while(!file.eof()) //While it is not the end of the file...
cout<<setw(5)<<ID; //Display ID
cout<<setw(20)<<NAME; //Display First name
cout<<setw(20)<<GRADE<<endl; //Display Grade
file>>ID>>NAME>>GRADE; //Reads from the data file (ERROR IS AT THIS LINE)
file.close(); //Closes the file
you do not use file.seak(std::ios::begin) between the read and write. Nor do you open the file do write operations, then close it and then reopen it. Unless you know how to manipulate the file pointer, it is never a good idea to mess with the file pointer in the way you have.