سلام این کد که میگذارم برای ویرایش یک رکورد در فایل هست زمانی که رکوردی که میخوام ویرایش کنم پارامتر بازیابی اون فیلد id که نوعش int هست درست کار میکنه ولی روی نوع char کار نمیکنه
دلیلش چیه ؟
این کد ویرایش با فیلد char هست که جواب نمیده اگه همینو با فیلد id که از نوع int هست جواب میده :
void edit()
{
char en[91];
ifstream in("dic.dat",ios::in|ios::binary);
ofstream out("temp.dat",ios::out |ios::binary);
clrscr();
cout<<"please enter a enword";
cin>>en;
while(in.read((char *)&translation,sizeof(struct translate)))
{
if(translation.enword==en)
{
cout<<"enter a new a information";
cout<<"enword";
cin>>translation.enword;
cout<<"faword";
cin>>translation.faword;
}
out.write((char *)&translation,sizeof(struct translate));
} //endwile
in.close();
out.close();
remove("dic.dat");
rename("temp.dat","dic.dat");
getch();
}
با تشکر