can anyone tell me which part/line of this code makes the recorded data to be deleted.. i'm actually trying to make an employers payroll record that adds, display, delete and update a certain record..
i tried to remove the data.write but still it deletes the file, i dun have idea now what really deletes the file.... HELP PLEASE!!
here is the function definition of the code...
[purple]void delEmp(){
fstream data, temp;
emp e;
int eno;
cls();
cout<<"===== Delete Record ====="<<endl;
cout<<endl<<endl<<endl;
cout<<"Enter ENO to delete record ";cin>>eno;
rename("data.dat","temp.dat");
data.open("data.dat",ios::app);
temp.open("temp.dat",ios::in);
temp.seekg(0,ios::beg);
while(temp.read((char*)&e,sizeof(e))){
if(!(e.eno==eno)){
{ cout<<"Ecxisting records "<<e.eno<<endl;}
data.write((char*) &e,sizeof(e));
}
}
data.close();
temp.close();
system("Del temp.dat");
main();
}[/purple]
Comments
__________________
[url=http://www.4rsgold.com/]Runescape Gold[/url]
[url=http://www.fzf.com/Runescape.gold]Cheap Runescape Gold[/url]