like i said - those problems are ones i noticed straight away.
They are other errors ( I just noticed another pinter related issue in the
RWrecord function).
Also, if the file is empy to start with, you cannot save a record at position 2 in the file - as this will be the only record in the file - which means you cannot reload it from position 2 because the file has only one record in it. See what I mean??
in your code -
sizeof(three)
gives the size of the
three object which an object of
MyClass
so sizeof(three) and sizeof(MyClass) should give the same result
**I repeat - what sizeof() reports as the size of an object (for example the size of a structure) is
CORRECT -- any value that you calculate by adding up the individual sizes of the members
of that structure is
WRONG if it differs from the sizeof value.***
So you mayhave got the size of every element and the size is is 'as expected' - but as you have
found, the overall size of the structure is bigger.
re-read my first post about compilers padding out structures for efficieny reasons.
If you want the structure to be an exact fit to the members - you will have to use
a compiler_specific option on the structure ( a
pragma directive if you are using microsoft visual C++)
This explains it:
http://en.wikipedia.org/wiki/Sizeof
if you scroll down to the end you will see -
structure padding