To search for the employee record on the file:
int search (fstream &f , char* name, Employee &E){
Employee emp;
int loc;
f.seekg( 0 , ios::end);
loc=f.tellg();
while( loc > 0 && !found){
loc -= sizeof(emp);
f.seekg(loc);
f.read((char*)emp , sizeof(emp));
if (emp.name() == E.Name()){
E = emp ;
found = true;
}
return found ;
}
No comments:
Post a Comment