tags:

views:

50

answers:

0

Hi,

I do have a very complicated problem here, and I really appreciate any help.

We do have a very big program here which consists of very various parts which has been written by many various people which all of them are not available now!

each part reads its data from its own files which makes it very hard to maintenance and ... . now we wanna make a "stand alone" and "single file" data manager, so all parts of the program reads their data through it.

for example if one part of the program read its data from "myverygooddata.txt", now we need to it asks for it via our data manager like this: DataManager["myverygoodconfig.txt"].

this required that I give them a part of the memory as a file. so that part of the program will read its own data from there which the DataManager wrote there before.

is it possible by any means?

Update: for example consider the following function:

void LoadMyData(FILE* a)
{
... // it load its own data here.
}

we called this function like this in our program:

LoadMyData(fopen("in.txt", "r"));

there are lot's of like this codes in our program. now we wanna have a single data file. so we should call the function something like this:

DataManager.Init(); // loads the single data file into memeory
LoadMyData(DataManager.Open("in.txt"));

so DataManager will open a file in "memory" and will give the LoadMyData function a pointer into memory so it will read the data from there. is it possible to do this?