I'm trying to read data from a file line by line and push them back to a vector The data is of the format 123 23 45 19 46 22 87 26 31
The program gives no output and an error code of 11.
std::vector<int>* readDataFromFile(std::string path){
std::vector<int>* v = new std::vector<int>;
int a, b, c;
std::ifstream inputStream;
inputStream.open(path);
while(inputStream>>a>>b){
v->push_back(a);
v->push_back(b);
v->push_back(c);
}
inputStream.close();
}
int main() {
std::vector<int>* v = readDataFromFile("file1.txt");
for(auto it= v->begin(); it != v->end(); it++){
std::cout<<*it<<std::endl;
}
return 0;
}