I can use the program fine without this code but I need to be able to take a line of text a file and read it into a variable. Here is the code causing the app crash:
string ReadLine()
{
getline(file, lineread);
if (lineread.find_first_of("WSF_") != string::npos)
{
return lineread;
}
}
What I need it to do is take a line in the text file and if it is not a W S F or _ it is an invalid line and my program will default to a hardcoded value for my maze.
Row1 = ReadLine();
Row1 is a string and the readline should set Row1 to lineread.
The first line currently contains: WWWWWWWW
Not using the function lets the program run but otherwise it crashes. Is there any way to get a line at a time from the already loaded file and have it returned as a string like it should be to the program?