Sir i want to ask a question about filing.
Whenever i do the following i got the output in the form of non-terminating loop.
the code is
cerr<<"File was not opened "<<endl;
while(myfile && !myfile.eof())
myfile.read(reinterpret_cast<char *> (&myemp),sizeof(employee));
Please tell me the solution.
I have to submit the assignment in two days.
The problem may be that your C++ facilities do not set eof. Check the documentation. I found an alternate way to check for eof. Please see the following link:
Check for while ( myfile.read(reinterpret_cast <char*>(%26myemp),sizeof(employee)) != 0 ) instead of eof.