Answer the question
In order to leave comments, you need to log in
Why doesn't Visual Studio open the file when debugging?
int main()
{
ifstream fileList("paths.txt");
vector<string> paths;
string path;
int i = 0;
if(fileList.is_open())
{
while (!fileList.eof())
{
getline(fileList, path);
cout << path<<endl;
paths.push_back(path);
i++;
}
fileList.close();
}
system("pause");
return 0;
}
Answer the question
In order to leave comments, you need to log in
By default, when starting a project from the studio, the current directory is the project directory. Therefore, during debugging, the program does not find the file you need (which is located in another directory - in the debug folder. This behavior can be changed in the project settings:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question