I am working on a game where I had too much global data. My current solution is to write the data to a file and then to read it back. Here is some code:

fstream f;
f.open("\\screens.txt", ios::in | ios:: out | ios::binary);
...
int screen0[20][20] = {...
for (int i = 0; i < 20; i++)
for (int j = 0; j < 20; j++)
f.write((unsigned char*)screen0[j][i], sizeof(int));
for (int i = 0; i < 20; i++)
for (int j = 0; j < 20; j++)
f.read((unsigned char*)screen[j][i], sizeof(int));

I have multiple arrays for each screen in the game (screen0, screen1...), and depending on a condition, I want to make the current screen a copy of that certain array. I do this by putting the selected screen in a file and then reading it out as the screen array.

I know it sound kinda wierd, but I have tried a lot of things and nothing has worked yet. The problem with this is that I get error messages in the linking process, such as
Undefined symbol filebuf:: openprot in module.
...

Does anyone have an idea what might be causing this? I would greatly appreciate any help you can offer.