contents of file.txt
a
b
c
a
b
c1 x c2
d
a, b, c, c1, c2, d are all some values.
My function
void Menu::readFile() {
string line;
ifstream myfile ("file.txt");
if (myfile.is_open()) {
while (getline (myfile, line)) {
cout << line << "\n";
}
myfile.close();
} else cout << "Unable to open file";
}
This is just returning the contents of the file, how can I read the file and parse each line into a variable. Each line break separates the objects.