fstream - correct error checking after output
- by Truncheon
What's the correct way to check for a general error when sending data to an fstream?
I have the following code, which seems a bit overkill.
int Saver::output()
{
save_file_handle.open(file_name.c_str());
if (save_file_handle.is_open())
{
save_file_handle << save_str.c_str();
if (save_file_handle.bad())
{…