cache

hi
i am trying to simulate accesses in a direct mapping cache.
my program currently reads in a file that is supposed to declare the size of the cache. so far i have the following code

int main (int argc, char* argv[]) {

ifstream inFile;
inFile.open("config.txt");
if (!inFile) {
cout << "Unable to open file";
exit(1); // terminate with error

}

inFile.close();
return 0;

but now that i read my file in what i would like to no is how do i store the value inside the file to be the size of the cache?
i also no that later on i will need to find a suitable data structure for each cache entry therefore i will need to keep in each entry the address/id, the item i want to store, and a boolean to say if the entry is valid. any help with this will be greatly appreciated
tahnks
Do you want to read and store a number? You can read the data into a variable.

int data;
cin >> data;

But you can use the mfc CFile class:

http://www.codersource.net/mfc_cfile.html
Topic archived. No new replies allowed.