I am trying to read a file in from a text document into 2 arrays. I've ruled out the problem being in my other functions or my mains, and that leave about 5 lines of code....
It will cycle through my document to the end, but it only inputs the txt once through the loop. Any thoughts would be great!
void load_donations(string donor[], string donation[])
{
string text;
cout << "What *.txt file would you like to load? ";
cin >> text;
text += ".txt";
cout << text << endl;
ifstream infile;
infile.open (text.c_str());
int i = 0; //moves to next slot in array
while (!infile.eof())
{
getline(infile, donor[i]);
getline(infile, donation[i]);
i++;
}
infile.close();
}