from txt file to linked list

how to store the elements from txt file to linked list?
1
2
3
4
5
6
7
8
9
10

std::fstream file;
file.open("text.txt",std::ios::in | std::ios::app);

std::list<std::string> myList;
std::string line;

while(std::getline(file,line,' '))
 myList.push_front(line);
Last edited on
Topic archived. No new replies allowed.