#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
char c, str[256]="";
ifstream file;
while(true)
{
// bitmask设置异常
file.exceptions(ios::badbit|ios::failbit|ios::eofbit);
cout << "Enter the name of an existing text file: " << endl;
cin.get(str,256);
try
{
file.open (str);
cout << str << " is open for displaying content.\n";