So basically, I have no idea. I can't get getline to work for the structure and I've been trying for hours upon hours. I'm also using a function. Any help would be appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
void studentRegistration(Values info[MAX_STUDENT], int size)
ifstream inFile; //needed to open file and read
for (int i = 0; i < 11; i++)
cout << "Done.\n";
My structure looks like this:
1 2 3 4 5 6
That still leaves room for uncertainty, I can't be sure whether the ID is an integer or maybe contains other characters. name must be a string, not a single character. answer could be anything, an integer, a character, a string of several words.
Given that your struct had char name; which doesn't make sense, it is quite likely that the other parts may be wrong or less than optimal too.
Assuming that only the name is a string, maybe do it like this. Here I read the file one line at a time, then extract the details from that line. A stringstream is used to do that. Also I passed the size by reference, to hold the actual number of records read from the file.