The problem is that it is reading the records more than what is written and keeps repeating them again and again..please tell me the problem ... i am unable to identify it..
/* Writing the Structure to the Binary File*/
for(int i=0;i<6;i++)
{
stream.write((char*)(&conf[i]),sizeof(configStruct));
cout<<conf[i].PointId<<conf[i].std_type<<endl;
//cout<<i<<endl;
}
stream.seekg(0); /* Moving the file pointer to the start.*/
/* Reading the structure from the file */
i =0;
I think I solved it myself after lot of brain crunching...
the problem was ... i didnt close the stream after writing into it.
so there was no "EOF" character in the file..that is why it was going on and on..
Moreover this memory was corrupting the global variables also...which actually forced me to find a solution to the problem . since it didnt cause any program crash.
the structure into which i was reading the file was getting larger and larger and was overwriting the nearby memory locations due to the buffer over run.