Write a program that prompts for an input file name, receives the input file name in a C-string. The program should check for errors opening a file. It is not necessary for the program to do anything other than open the file.

What will be an ideal response?

```
#include
#include //unnecessary, fstream gets this
#include //for exit(int)
int main()
{
using std::ifstream;
using std::cout;
using std::cin;

char name[16];
cout << "enter a file name, 15 characters max:\n";
cin << name;
ifstream inStream;
inStream.open(name);
if (inStream.fail())
{
cout << "Opening file " << name <<" failed\n";
exit(1);
}
// code that uses the file
```

Computer Science & Information Technology

You might also like to view...

HTML and XML are both examples of ________

A) markup languages B) web query sources C) tags D) multimedia

Computer Science & Information Technology

A layer that is "clipped to another layer" or "using a

clipping mask" means that the layer interacts with and affects only the layer directly below it. Indicate whether the statement is true or false

Computer Science & Information Technology