Others examined situations that could lead to output failures.
But:
Do I need to check every call to a record or <<to make sure it is executed correctly?
For this, I would answer no. You might as well check
- if the file was opened successfully, and
- if the stream is still
good() after you write your data.
It depends, of course, on the type of recorded data and the possibility / relative complexity of recovering from partial recording and restarting the application.
If you need more careful management when a write error has failed (for example, in order to make a graceful recovery), the associated exception stream associated with it is the way to go. The state of the poll stream after each operation will inflate the code.
source share