Title
What is the state of a stream after close() succeeds
Status
nad
Section
[file.streams]
Submitter
Steve Clamage

Created on 2008-07-08.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

Tom's impression is that the issue is about the failbit, etc.

Bill responds that the stream is now closed, and any status bits remain unchanged.

See the description of close() in [fstream.members].

We prefer not to add wording to say that nothing changes. Move to NAD.

Date: 2008-07-08.00:00:00

Suppose writing to an [o]fstream fails and you later close the stream. The overflow() function is called to flush the buffer (if it exists). Then the file is unconditionally closed, as if by calling flcose.

If either overflow or fclose fails, close() reports failure, and clearly the stream should be in a failed or bad state.

Suppose the buffer is empty or non-existent (so that overflow() does not fail), and fclose succeeds. The close() function reports success, but what is the state of the stream?

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg4108
2008-07-08 00:00:00admincreate