I have a program which creates variable amounts of data in arrays of linked lists (up to 12GB or so) and then dumps it to file. Since I cannot hold everything in memory at the same time on a computer with 4G of ram, I am trying to store pieces of it in files and then combine it after all the data is created. My problem is, I don't know how many files I would need since different amounts of data are given to the program. I would like to be able to declare new files as I go (tempfile.0, tempfile.1.....) with something like:
1 2 3 4 5 6 7 8 9 10 11
int counter=0;
while (!feof(infile))
{
FILE *tempfile.counter;
for (int a=0; (a<100000000 & !feof(infile)); a++;
{
//Get data from infile;
//dump manipulated data to tempfile.counter;
}
counter++;
}
Is there some way to use integer variables to declare new variable names?
I wish i could do an appended output. I have to append line by line ie line1 of file2 to line1 of file 1 etc. The link looks like it could work though. Thanks!