I'm trying to read a line from a text document so I can move it into an array. So I've tried to get this to work out and it stops when it sees the "while" line.
void input (ifstream& file, int& end, string word[])
{ int x = 0;
string line;
getline (file, line);
while (line != '/n')
{ line >> word[x];
x++; }
end = x - 1;
}
I understand that it doesn't code in the /n when using getline, but how do I get it to keep doing this until there is nothing left in string line?
I've attempts just getting the line and printing it out right after and that just caused it to crash so I'm at a loss of what to try.