I'm quite new to c++ and im trying to figure out how to use recursive function to read a .txt file and to save them in a string. I want the function to return a value of true when the reading is finished. I've tried to find solutions on the internet but so far no luck. I've tried the following:
void readFile(ifstream& stream, vector<string> v)
{
if (stream.eof()) {
return true;
}
else {
string line;
getline(stream, line);
v.pushback(line);
readFile(stream, v);
}
}
Note that I want to use these parameters and I don't want to change them