I think I may not have the file I'm trying to read in the right spot but i've put it everywhere possible in the IDE and it is still not working. Ive even put it next to the .exe for my program and it still cant find it.
I was expecting the file to be able to be opened so I can read its contents with c++ code.
#include <iostream>
#include <fstream>
#include <cstdlib> // exit prototype
#include <iomanip>
using namespace std;
int main(int argc, char* argv[])
{
ifstream inFile;
string filename = "infile6";
// if a filename is provided, open file
cout << "Enter the name of a file to read from: " << endl;
//cin >> filename;
cout << "Name of a file requested: " << filename << endl;
inFile.open(filename.c_str());
if (!inFile)
{
cerr << endl;
cerr << "File cannot be opened" << " " << filename << endl;
exit(1);
}
return 0; // ifstream destructor closes file
} // end main
std::file_system::current_path()or equivalent to see where the CWD is actually pointing.inFilefromstd::stringwithout converting name to C-style string:std::ifstream inFile(filename)