Write and read class objects in binary file

if i have 2 variables for which values are given by the user,then,does the information get stored into the file in the name of the variable,or just like packs of information.....if the former is true,how to extract the information of a particular variable alone from the whole file?
Packs of information by the size of the variable.

You will need to know the offset into the file that the data is stored. The offset is the number of bytes that precedes the information.

So:

char s;
char y;
char t;
int Amount;

You want Amount, so the offset is 3 bytes, since a char is one byte.
So,i need to move the file pointer by 3 bytes to access the Amount?
Yes.
how to use this pointer in accssing file?
Topic archived. No new replies allowed.