i created a program that read from a txt file and use getline() to retrive every line from my file. But i wanted to store the digit into list<int>, when i do a print of stl list i get the result which not i wanted. i wanted to have "2 4 6 8 10 1 3 5 7 9" in the list when i print from stl list
what am i suppose to do?
getline(fin,line);
if(line == "abcd 2 4 6 8 10 1 3 5 7 9")
{
line.erase(0,5);
for(int i=0; i<line.length(); i++)
{
line.erase(0,i);
int num = atoi(line.c_str());
myList.push_back(num);
}