Guest User

Untitled

a guest
Jun 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. vector<vector<string>> list;
  2. int size; //number of columns
  3. while(getline(file,line,','))
  4. {
  5. vector<string> test;
  6. list.push_back(test);
  7. list[i%size].push_back(line)
  8. }
  9.  
  10. vector<vector<string>> list;
  11. ifstream file("myfile.csv");
  12. while(file){
  13. string line;
  14. if(!getline(file,line)) break;
  15.  
  16. istringstream ss(line);
  17. vector<string> word;
  18.  
  19. while(ss){
  20. string s;
  21. if(!getline(ss, s, ',')) break;
  22. word.push_back(s);
  23. }
  24. list.push_back(word);
  25. }
Add Comment
Please, Sign In to add comment