UPDATE: I was misled by the latest error logs from the debugger. I had to manually disable part by part of code in order to find the error making line.
Could you kindly give me an advice which part of the following code causes (sometimes) heap corruption?
I use Qt on Windows and this sort of a problem is not trivial for me, since there is no Valgrind for Windows.
I have the numerical values in some text files. They are 3-4 digit integers (max 250 of them in one file) separated by white characters. Under 'debug' mode this worked flawless up to some point - when I used 12 text files. I enlarged my database with some additional bigger text files and now it crashes more often. Under 'release' mode the application exits with code -1073741819 most of the times.
Maybe this approach is not appropriate one at all? If so, what are the alternatives?
filesTable[0].open(some_directory);
...
//other files...
...
for(int i=0;i<number_of_files;i++)
{
vector<string> data_vector;
string number;
files[i] >> number;
while(files[i])
{
if (number.size() > 0)
data_vector.push_back(number);
files[i] >> number;
}
files[i].close();
int size = data_vector.size();
int point[size];
for(int j=0; j<size;j++)
point[j]=atof(data_vector[j].c_str());
data_vector.clear();
}