The test file for this function is located on my desktop in a folder.
Is the syntax correct when (string folder) is being set to the test file at the file location?
Code:ifstream get_ifs( ) // get input file stream
{
string filename; // input file name
cerr << "name of file to read from? ";
cin >> filename;
string folder = "C:\\Users\CASHOUT\Desktop\week8\folder\test1.txt"; // path for folder containing
// the .txt test files
filename = folder + filename;
ifstream ifs( filename, ifstream::in );
if( ! ifs ) // cannot open input file
{
cerr << "cannot open input file '" << filename << "'\n";
exit( 1 );
}
return ifs; // return input file stream
}