C++ ifstream: Can't open text file

With the string is, I open a text file with "is.open(AMatrix.txt").
When I run
if(is.is_open())
cout << "Open Successful." << '\n';
else
cout << "File not found." << '\n';

It always returns "File not found.
This is even when I specify the target file path.

The file you are trying to open, AMatrix.txt, is not in the current working directory so the file isn't found.

There are multiple ways to fix this. First, you can supply the complete path to the file in your code.

Second, you can set the working directory for the Xcode scheme and set it to the directory where the file you want to open resides. In the project window toolbar to the right of the Run and Stop buttons is a path control. The left item in the path control is the name of your project. Click the item and choose Edit Scheme to open the scheme editor. Select the Run step from the left side of the scheme editor. Click the Options button at the top of the scheme editor. Select the Use custom working directory checkbox. Click the folder icon to open an Open panel to choose the working directory.
C&#43;&#43; ifstream: Can't open text file
 
 
Q