std::string line;
std::ifstream myfile("data/users.txt");
bool fileExists = myfile.good();
if(fileExists) {
if (myfile.is_open())
{
while (getline(myfile, line))
{
std::string name = line.substr(0, line.find(","));
std::string age = line.substr(line.find(",") + 1, line.length());
people.push_back(Person(name, std::stoi(age)));
}
myfile.close();
}
}
else std::cout << "Unable to open file";