hi! saving a struct..., kewl! but need more info...,
ofstream savestruct;
savestruct.open("names.dat");
savestruct.write((const char*), sizeof(savestruct));
like after doing those 3 statements, everything that contains in your struct(ie, savestruct) will automatically be written to the file right? in binary form actually.
and then, when you want to read it...,
ifstream loadstruct;
loadstruct.open("names.dat");
loadstruct.read((char*)&loadstruct, sizeof(loadstruct));
for the questions plz...,
(1)after that, the loadstruct will be AUTOMATICALLY filled in right?? wow, this is kewl ain't it? (2)but, how? so probably, when saving a struct, it has some added info on how the struct is organize huh?
(3)so are the graphics file formats say.., PNG, BMP, JPG, are also in someway save as structs? so if i know their struct, i could also do something like that? and automatically the struct will be filled in?
(4)is this how someone can come up with his own file format?
thanks!!! :)