Saving a Large Array for Quick Reference

I need to store 15,000,000 sets of variables a 1000 x 15000 array, in a file. The only way I know how is to just save if all with fstream into a text file, this is very impractical to save and read only small portions of the file at a time. I asked a friend, and he said look into serialization, but from what I read, it seems that serialization can only be used to save / load the entire file. I need to pull out a ~150 x 300 block of variable sets, and I don't want all of the whole thing in memory, because how much it takes.


So basically, can I use serialization to quick reference a small square out of a large 2d array and be able to save over it, and how, or is there a better way.


Also, for the record, I'm using this to save a map in a Terraria-ish game, am I going about this completely wrong?
Last edited on
If your set of variables have the same size you can use a binary format with random access.
Topic archived. No new replies allowed.