My code is supposed to open a file and work with the data that it reads in. My code looks like this:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
ifstream input_file;
input_file.open("practice.txt");
if (input_file.fail())
{
cout << "Attempt to open file failed." << endl;
}
else
It always returns "attempt to open file failed". I am definitely using the correct file name, so what are some reasons that the file isn't opening?
How do I solve this issue?
EDIT: spoke to another girl in my class with a Mac and her code works perfectly when not run on Mac but won't open the file when she runs it on her computer so I think it's a problem with my compiler. Thanks for the help!!