My program keeps crashing and I can't see why, if I remove the line
myfile << data_[i+ndim_*j] << " ";
then it runs OK...but can't see anything wrong with this line?
void Matrix::WriteToFile(std::string fname) const
{
ofstream myfile;
myfile.open ( (fname+".txt").c_str() );
for (int i = 0; i<mdim_; i++)
{
for (int j = 0; j<ndim_; j++)
{
myfile << data_[i+ndim_*j] << " ";
}
}
myfile.close();
}
// Save matrix in file 'fname'