int main()
{
string line;
ifstream ifs;
string fname;
cout << "Address file name: ";
cin >> fname;
ifs.open(fname.c_str());
if (!ifs.is_open()) {
cout << "Unable to open input file '" << fname << "'" << endl;
exit(0);
}
// Now process the file
...
}