Write CSV file into vectors
I have 8x14800 matrix that has been extracted from matlab as CSV file ("moves.mo"). I need to read this file into 14800 vectors with 8 values each. Can you please navigate me here?
So far, I am here:
std::fstream inputfile;
inputfile.open("moves.mo");
std::vector< std::vector<int>* > vectorsmovesList;
while (!inputfile.eof()) {
std::string line;
getline (inputfile,line);
开发者_JS百科if(""!=line) { //if line is nonempty
std::vector<int>* mvec = new std::vector<int>(); //allocate a vector vec(N)
/* loop to read file has to go here */
}
inputfile.close();
}
return 0;
}
Thank you very very much!!!!
see Split a string in C++?
精彩评论