I'm trying to make a program that puts the lines in a file into a vector. For some reason its only putting the first line into the vector:
Code:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<sstream>
#include <fstream>
using namespace std;
int main()
{
string temp;
istringstream line;
vector<string> vline;
ifstream iFile{"file.txt"};
while(getline(iFile,temp,'\n')){
line.str(temp);
for(string s;line>>s;){vline.push_back(s);}
}
for(auto &e:vline)
cout<<e;
return 0;
}