Like the previous post said, when structures are written to file, the contents of the struct are written in the order they are declared
Code:
struct Mess
{
int scooby;
double doo;
}
If you wrote this structure to file, then scooby would be written before doo. If you read this information back into memory from the file, then it's done the same way. scooby is read first, then doo is read.
(1)after that, the loadstruct will be AUTOMATICALLY filled in right??
yes.
wow, this is kewl ain't it?
erm... yeah, i guess.
(2)but, how? so probably, when saving a struct, it has some added info on how the struct is organize huh?
already explained.
(3)so are the graphics file formats say.., PNG, BMP, JPG, are also in someway save as structs?
yes and no (depends on the file format), but the are a bit more in depth. you will have to search around and read up on the file formats individually to understand how they work. BMP files are a combination of structures and binary data.
so if i know their struct, i could also do something like that? and automatically the struct will be filled in?
yes, but like i said, it's often not as easy as that.
(4)is this how someone can come up with his own file format?
That's like saying "is this how someone writes a word on a piece of paper". Coz essentially that's all you're doing.
If you want to come up with your own file format, then you can do it any way you like. it doesn't have to be binary, it doesn't have to be ascii text, it doesn't have to have a lot of structure, it doesn't have to have structures written to it.. it's completely up to you.
Hope this helps.
U.