#include //C++ example #include //for ofstream #include //for setw #include using namespace std; void f(); int main(int argc, char **argv) { f(); return EXIT_SUCCESS; } void f() { //The constructors called in lines 20 and 26 open two output files. //Clobber the files if they already exist; create them if they don't. ofstream out1("outfile1"); if (!out1) { //if (out1.operator!()) { cerr << "can't open outfile1.\n"; exit(EXIT_FAILURE); } ofstream out2("outfile2"); if (!out2) { cerr << "can't open outfile2.\n"; exit(EXIT_FAILURE); } out1 << "hello\n"; //Output 6 char's. Do not output '\0'. out2 << setw(8) << "goodbye" << "\n"; } //Call destructors for out2 and out1.