i cannot extract anything from the file in the tilstart function but the program finishes with no issues. The goal of the function is to go through the txt file until it gets to "start". I have to use recursion but i had to (//)tilstart(files) in the end of the function to prevent stack overflow since the file wasn't giving an input. the cout << start was so i can see if the program was picking up word.
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
void tilstart(ifstream& file)
{
//ifstream files(file);
string start;
file >> start;
cout << start;
if (start == "start") {
cout << start;
return;
}
cout << start;
// tilstart(file);
}
int main()
{
ifstream files("input13.txt");
files.open("input13.txt");
if (files.is_open()) {
tilstart(files);
}
return 0;
}
this is the filevvv.
going there start h f t