I have SOME_TEXT.TXT in the Debug folder for my project. When I manually go to the Debug folder and run the application, I get the expected output and all is glorious. However, when I Debug the app within Visual Studio txtFile.is_open() fails and my output doesn't work. I've looked around in the other directories and I see no other executable. I've even tried liberally spreading SOME_TEXT.TXT around in case I missed a directory. Any ideas?
I have the following code:
string path = "SOME_TEXT.TXT";
ifstream txtFile;
txtFile.open(path, ifstream::in);
char line[200];
if(txtFile.is_open())
{
int lineNumber = 1;
while(!txtFile.eof())
{
txtFile.getline(line, 200);
Line * ln = new Line(line, path, lineNumber);
lineNumber++;
myList.addLine(ln);
}
}
myList.printAll();