A conversion operator changes a file stream into a boolean value, whereby the value indicates the success or failure of the file opening operation.
A conversion operator changes a file stream into a boolean value, whereby the value indicates the success or failure of the file opening operation.
char fileName = "outfile.dat";
ofstream ofd(fileName); // create file for output
if (! ofd) { cerr << " cannot open file " << fileName
} else { ofd << "first line in file" ...
File operations in C++ throw far fewer exceptions than do in Java.