Mail Archives: djgpp/2000/06/04/17:30:06
hello Djgpp
I was hoping you would have time to help me.
I have a difficulty storing classes to Random Access files.I use the seekp,seekg, and read and write functions but end up with data that are pushing each other out of position in the file.
I checked with tellp()and that showed me that when the program writes a record it writes past its allotted position by 2 or up to 8 spaces,whatever it seems to feels like.
How do I make sure this doesn't happen?
this is an excerpt:
inout.seekp((num-1)*40);
cout<<"start write"<<inout.tellp();
inout.write(reinterpret_cast<const char*>(&client),40);
cout<<"after write"<<inout.tellp()<<endl;}
startwrite here yields 40
after write yields 88
that's 8 spaces into the next record
I appreciate any advice you may have
Frans Nagel
_______________________________________________________________________
Why pay when you don't have to? Get AltaVista Free Internet Access now!
http://jump.altavista.com/freeaccess4.go
_______________________________________________________________________
- Raw text -