Ok so I have to open a file using a function with error checking.. But I can't get the file to open..
Code:#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream myIn;
OpenFile(myIn);
myIn.close();
}
void OpenFile(ifstream& myIn)
{
string filename;
do{
cout << " Please enter the file name to receive student information from: ";
cin >> filename;
myIn.open(filename.c_str());
}while (!myIn);
}

