You are writing a program. Give the necessary statements to open a file and to confirm that the file has been successfully opened for writing. Important: Why bother to test?

What will be an ideal response?

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

ifstream inStream;
inStream.open("myFile.txt";);
if (inStream.fail())
{
cout << "Input file failed to open\n";
exit(1);
}
}
```

Computer Science & Information Technology

You might also like to view...

Once an attachment is added, the only way to delete the attachment is to delete the record

Indicate whether the statement is true or false

Computer Science & Information Technology

The ________ function looks up values in a table array arranged as horizontal rows

Fill in the blank(s) with correct word

Computer Science & Information Technology