1
嗨,我要覆蓋我已經設置了位置上的特定文件的內容(對象),但它總是添加到文件覆蓋數據使用fstream的
代碼
int InputIO::editPatient(int location,Obj P){
int positon=location*sizeof(P);
f.open("File.dat",ios::in|ios::out|ios::app|ios::binary|ios::ate);
f.seekp(0,ios::beg);
f.seekp(positon,ios::cur);
f.write((char*)&P,sizeof(Movie));
f.close();
return 0;
}
結束一個C++文件