Just put all of the variables in a struct, then save the struct as a file. File size is the size of that struct. Then load the file to the struct as neeeded.