I'm building a program that handles input file and output file, with Visual Studio 2012.

I implemented like this:

```
ifstream inputFile;
ofstream outputFile;

inputFile.exceptions ( ifstream::failbit | ifstream::badbit );
try
{
    // some codes here
    inputFile.open(inputFileName.c_str());
    cout << "Input file opened" << endl;

    outputFile.open(outputFileName.c_str());
    cout << "Output file opened" << endl;
}
catch (ifstream::failure e)
{
    cerr << "Failed to open input file" << endl;
    return -1;
}
catch (ofstream::failure e)
{
    cerr << "Failed to open output file" << endl;
    return -1;
}   

```

And a compile error occurs:

```
error C2312: 'std::ios_base::failure' : is caught by 'std::ios_base::failure' at line 248

```

How do I implement try-catch with two sources of exception?