N
Newsgroup - Ann
The fstream is supposed to be a replacement of the stdio.h and the exception
is supposed to be a replacement of the return error code. So how do I
replace my old codes of the style:
if (output = fopen(...) == NULL) {
perror("...");
exit(1);
}
by the C++ style? The only thing I can do now is like
fstream output("...", ios_base:ut);
if (!output.is_open()) {
cerr << "..." << endl;
exit(1);
}
how do I use exception here? Or I should not?
Ann
is supposed to be a replacement of the return error code. So how do I
replace my old codes of the style:
if (output = fopen(...) == NULL) {
perror("...");
exit(1);
}
by the C++ style? The only thing I can do now is like
fstream output("...", ios_base:ut);
if (!output.is_open()) {
cerr << "..." << endl;
exit(1);
}
how do I use exception here? Or I should not?
Ann