J
John Ratliff
Is this a legitimate (standards compliant) way to check for errors in
file I/O.
#include <fstream>
fstream output("file.ext", std::ios_base:ut, std::ios_base::binary);
if (output) {
// we're good to write to file.ext in binary mode
output.close();
}
I thought I saw a C++ book say this was good, but I can't find a
reference on the internet and I don't know where my C++ book is right now.
I've seen this:
if (!output) {
// file wasn't opened
}
Also, Is binary default or do I need to specify it explicitly when I
open the fstream?
Thanks,
--John Ratliff
file I/O.
#include <fstream>
fstream output("file.ext", std::ios_base:ut, std::ios_base::binary);
if (output) {
// we're good to write to file.ext in binary mode
output.close();
}
I thought I saw a C++ book say this was good, but I can't find a
reference on the internet and I don't know where my C++ book is right now.
I've seen this:
if (!output) {
// file wasn't opened
}
Also, Is binary default or do I need to specify it explicitly when I
open the fstream?
Thanks,
--John Ratliff