I'm writing a function to save and load a linked list as a binary. When I try to load the function it stops; the program doesn't crash or freeze but it won't continue beyond the point indicated:
void fLoad(char* fname)
{
fstream fin;
fin.open(fname, fstream::in|fstream::binary);
if(fin.fail())
{
cerr<<"unable to open file";
exit(0);
}
cout<<"File open";
fin.read((char*) &N, sizeof(int));
cout<<N;
system("pause");
for(int i=0;i<N;i++)
{
Clinked* current = new Clinked;
fin.write(current->site_name,sizeof(char)*100);
fin.write((char*) ¤t->cood_x,sizeof(double));
fin.write((char*) ¤t->cood_y,sizeof(double));
fin.write((char*) ¤t->dip,sizeof(double));
fin.write((char*) ¤t->strike,sizeof(double));
//fin.write((char*) current, sizeof(Clinked));
current->next=start;
start=current;
} //at this point it stops
cout<<"\n"<<fname<<" was read succesfully";
fin.close();
cout<<endl;
}
It's not that N is ridiculously large either; I've checked