using namespace std;
struct Movie {
string title;
string director;
string genre;
string yearRelease;
string duration;
};
int main(){
cout << "Hi";
ifstream fin;
string line;
vector <Movie> m;
fin.open("Movie_entries.txt");
while (getline(fin, line)) {
cout << line << endl;
stringstream lineStream(line);
getline(lineStream, m.title, ',');
getline(lineStream, m.director, ',');
getline(lineStream, m.genre, ',');
getline(lineStream, m.yearRelease, ',');
getline(lineStream, m.duration, ',');
m.push_back({title, director, genre, yearRelease, duration});
}
}
I am trying to push back the struct into the vector to store my data and am having trouble in how exactly to do that. This is what I currently have.