Page 401 - C++
P. 401
remove("student.dat");
rename("temp.dat","student.dat");
}
//***********FUNCTION TO MODIFY STUDENT STRUCTURE**********
void modify()
{
clrscr();
fstream fin("student.dat",ios::in|ios::out|ios::binary);
int t;
cout<<"\n Enter the Admno of the Student whose record is to be Modified";
cin>>t;
long offset=0;
while(fin.read((char *)&s,sizeof(s)))
{
if(t==s.retno())
{
s.enter();
fin.seekp(offset,ios::beg);
fin.write((char *)&s,sizeof(s));
}
offset+=sizeof(s);
}
fin.close();
}
//**************FUNCTION TO ADD FEE STRUCTURE**************
void ADDITION()
{
clrscr();
fstream file;
file.open("fee.dat", ios::app|ios::binary);
char rep;
do
{
f.enterd();
file.write((char *)&f, sizeof(f));
cout<<"\n\t Want to add data for more classes ";
cin>>rep;
}while(rep=='y' || rep=='Y');
cout<<"\n Data has been added on the file";
file.close();
}
//************FUNCTION TO MODIFY FEE STRUCTURE*************
void MODIFICATION()
{
clrscr();
fstream fin("fee.dat",ios::in|ios::out|ios::binary);
int clw;
cout<<"\n Enter the Classes whose Fee Structure is to be Modified";