Hi. I have a program that reads from a couple large files and extracts select smaller files. The code below was working until I went from 22 extractions to 56. And this number may increase in the future.

At first, I thought one (or more) of the new entries had an error. However, the program works when I removed either the original half or the new half of entries.

Since it crashes with all entries, this leads me to believe that the problem is the volume of extractions and that the code needs to be optimized in some way.

I tried added pauses between extractions, but it still crashes immediately upon running. So I'm not sure if that indicative of something else.

Here is a snippet of the code...

Code:
#include <iostream>
#include <fstream>
#include <windows.h>

using namespace std;

int main(){

//Still crashes if pause is before all this code.
//std::cin.get();

ifstream infile001 ("Source1.xxx", ifstream::binary);
ofstream outfile001 ("001.yyy", ofstream::binary);
infile001.seekg(0x2a00000);
char buffer001[15000];
infile001.read (buffer001,15000);
outfile001.write (buffer001,15000);
outfile001.close();
infile001.close();

ifstream infile002 ("Source1.xxx", ifstream::binary);
ofstream outfile002 ("002.yyy", ofstream::binary);
infile002.seekg(0x3f00000);
char buffer002[27000];
infile002.read (buffer002,27000);
outfile002.write (buffer002,27000);
outfile002.close();
infile002.close();

//And so on...

return 0;

}
I've also tried making a extract call out of this code, but haven't been successful. Unless the code to fix this is more complex than the above code, I'm okay with not making an extract call as long as everything works. Any help is appreciated. Thanks!