Use getline(...) in the first loop and stringstream in the second:
1 2 3 4 5 6 7 8 9 10 11 12
std::vector<std::vector<string>> array;
std::string line;
while(getline(filein,line)){ // go through each line
array.emplace_back(); // an empty line will be created
stringstream ss{line};
string num;
while(getline(ss,num,',')){
array.back().push_back(num);
cout << array.back().back() << endl;
}
}