The code here is being used for creating a Student Report card project but while trying to understand we can not figure out the use of and functions of the lines below from the code.
This:
File.read(reinterpret_cast<char *> (&st), sizeof(student));
and this:
int pos=(-1)*static_cast<int>(sizeof(st));
Here is the main code:
File.read(reinterpret_cast<char *> (&st), sizeof(student));
if(st.retrollno()==n)
{
st.showdata();
cout<<"\n\nPlease Enter The New Details of student"<<endl;
st.getdata();
int pos=(-1)*static_cast<int>(sizeof(st));
File.seekp(pos,ios::cur);
File.write(reinterpret_cast<char *> (&st), sizeof(student));
cout<<"\n\n\t Record Updated";
found=true;
}