file.close() question

I have a short question:
Lets say we have a part of code like this:
1
2
3
4
5
int number;
ifstream file;
file.open("xxx.xxx");
file>>number;
file.close();


my question is related to close() method. If i would pass that line file.close(); will everything work fine? Is it so, that when the object file is destructed, the destructor calls the close() method automatically?

thx for reply,
JK
If i would pass that line file.close(); will everything work fine?
I don't understand the question.

Yes, close() is called automatically when the stream is destructed.
Last edited on
Topic archived. No new replies allowed.