Reading data into a linked list

How do I make this code read from the file contributors.csv and start assigning values to my Person (which is a class in a header file)?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  int main()
{
	string line;
	Person johndoe("", "", "", "", 0, 0);
	ifstream myfile ("contributors.csv");
	if (myfile.is_open())
	{
		while (myfile.eof() == false)
		{
			getline(myfile, johndoe)
			cout << line << '\n';
		}
		myfile.close();
	}
	else cout << "Unable to open file";
	cin.ignore();
	return 0;
	

}
Last edited on
Topic archived. No new replies allowed.