2

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);
    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!!!!

notrockstar
  • 833
  • 3
  • 15
  • 28
  • Maybe not an exact duplicate, but see: http://stackoverflow.com/questions/1894886/parsing-a-comma-delimited-stdstring/1895584 – Jerry Coffin Feb 09 '11 at 23:01

1 Answers1

2

see Split a string in C++?

Community
  • 1
  • 1
Foo Bah
  • 25,660
  • 5
  • 55
  • 79