C++ Function to edit a particular record in a binary file

Void editrec()
{
      fstream fio;
      student s;
int r;
fio.open("stud.dat",ios::binary|ios::out|ios::in);
fio.seekg(0);
cout<<" Enter the roll no. you want to edit : ";
cin>>r;
while(fio.read((char*)&s,sizeof(s)))
{
       if(r==s.retrno())
       {
cout<<"Record found !! ";
s.get();
fio.seekp(fio.tellp()-sizeof(s));
fio.write((char*)&s,sizeof(s));
}
}
fio.close();
}

Comments

Popular posts from this blog

How to extend validity or generate new Jio Coupon Code if Expired

List of Devices that will get Lineage OS 14.1 ROM

What is Lineage OS ?