Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vector<vector<string>> list;
- int size; //number of columns
- while(getline(file,line,','))
- {
- vector<string> test;
- list.push_back(test);
- list[i%size].push_back(line)
- }
- vector<vector<string>> list;
- ifstream file("myfile.csv");
- while(file){
- string line;
- if(!getline(file,line)) break;
- istringstream ss(line);
- vector<string> word;
- while(ss){
- string s;
- if(!getline(ss, s, ',')) break;
- word.push_back(s);
- }
- list.push_back(word);
- }
Add Comment
Please, Sign In to add comment