I just started using Visual Studio 2019 after using XCode for a while.
I was always able to open txt files in XCode but now
I can't open them in Visual Studio 2019.
Basically what I do is I press "Start Without Debugging" in the "Debug" tab I and get the error message "File Did Not Open!" from the else statement that I wrote. I am not sure if it has something to do with where the txt file is located or with the file path.
Below is the simple program that I've so far been using
to figure out how to open txt files in Visual Studio 2019:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream fobj;
fobj.open("input.txt");
if (fobj)
{
cout << "File Opened!
";
}
else
{
cout << "File Did Not Open!
";
}
return 0;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…