How can i write code to take integers from a text file and place them into a vector that holds integers?
Code:std::vector<std::string> elementVector; std::ifstream in("filename.dat"); std::string line; while( std::getline(in, line) ) { if( line == "<et>" ) { std::getline(in,line); stringstream st; st << line; std::string word; while( std::getline(st,word,'\'' )) { size_t pos = word.find('\''); if( pos != string::npos ) word.erase(pos,1); elementVector.push_back(word); } } }