I am trying to read a dat file into a vector the data is 5 in a row and 400 columns however, it results in cygwin_exception::open_stackdumpfile: Dumping stack trace to ....
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <vector>
using namespace std;
int main() {
char line[40];
vector<double> vec[400];
#define DEMENSION 5
ifstream file ("train.dat", ios::in);
//file.open("train.dat",ios::in);
int i=0,l=1;
double tmp;
while(!file.eof()){
//vec.push_back(l);
vec[i].push_back(l);
for(int j = 0; j < DEMENSION; j++) {
file >> tmp;
vec[i].push_back(tmp);
}
cout << vec[i].size()<< endl;
i++;
}
cout<<i<<endl;
//file.close();
for(int iy; iy < 400; ++iy){
vector<double>:: iterator iter = vec[iy].begin();
for(int ix = 0; iter != vec[iy].end(); ++iter, ++ix){
cout << *iter<<" " ;
}
cout<<endl;
}
return 0;
}
But if I change the dimension to 6, it works. Then the vector results in 7 number in a row(one number is add by me),left only 344 columns, which is not I want....It supposed to be 6 numbers if the dimension is correctly set at 5,