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
#include
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
```
You might also like to view...
Which of the following is most likely a base class of the other three?
a. automobile. b. convertible. c. miniVan. d. sedan.
In an RGB file, whenever the three components are the same, the pixel will have no color and can be only a neutral gray.
Answer the following statement true (T) or false (F)
The CSS specifications are overseen by the ____________________.
Fill in the blank(s) with the appropriate word(s).
The ____ form property contains the mailto address where the form results will be emailed or the URL to the dynamic page/script that will process the form.
A. Class B. Mailto C. Action D. MIME