struct list
{
char town[30];
int code;
spisok *next,*head;
};
void reading(list *x)
{
ifstream out("C:\\Users\\Tkachenko\\Desktop\\mp\\Lab_5\\file",ios::binary);
if (out)
{
while(!out.eof())
{
out.read((char*)&x->town,sizeof(x->town));
out.read((char*)&x->code,sizeof(x->code));
x=x->next;
}
out.close();
}
else
cout << "\n404 not found...";
}
我在阅读文件时遇到问题。它会写入与前一行重复的其他行。我该如何解决这个问题?