James,
Where can I find all the operations (e.g., check with
"is_open") I can do on stream objects? Thanks, Alan
From: James Gordon <Jam...@Cl...>
The reason you are not getting an error the first time you access invalid is
because when it is created the state bits are set to 'good'. After you have
tried to write out the state is not 'bad'. If you were to test and return if
the stream isn't open (is_open() returns true if the file pointer is not a
null pointer).
if (!output_file.is_open())
{
cout << "Error opening file." << endl;
return 1; // error indication
}
|