I see some people on this forum explicitly close files with the close() member function. I understand if you want to call close on a global fstream object or something but inside a small function I don't understand the point. It's like calling clear() on a local vector as the last thing in a function.
So, why are people calling close() when there is no need to?
It only makes sense to explicitly call fstream's close() if you're ready to handle the exceptions that function may throw (the destructor is non-throwing)
It is probably heritage of C I/O programming practices.
Thank you Cubbi! That's a good point that I have never thought about. If close() throws or not depends on what exception flags you have set but you can still check for errors without exceptions.