M
mohi
hello everyone,
i have a program where i write a structure of 1020B to a file a number
of times and in the next run of the program i have to again write
those structures but by taking some count from the last structure
written on the file
so i write it like:
fstream file("xyz",ios:ut|ios::in|ios::ate);
long pos=file.tellg();
pos-=sizeof(struct);
file.putg(pos,0);//position at pos
file.read(reinterpret_cast<char *>(&struct),sizeof(struct));
use struct.cout;///////
the problem is that after the read struct has a count which is of the
second last struct written
can some one help me why this gets two structs back in the file.
thank you very much
i have a program where i write a structure of 1020B to a file a number
of times and in the next run of the program i have to again write
those structures but by taking some count from the last structure
written on the file
so i write it like:
fstream file("xyz",ios:ut|ios::in|ios::ate);
long pos=file.tellg();
pos-=sizeof(struct);
file.putg(pos,0);//position at pos
file.read(reinterpret_cast<char *>(&struct),sizeof(struct));
use struct.cout;///////
the problem is that after the read struct has a count which is of the
second last struct written
can some one help me why this gets two structs back in the file.
thank you very much