The since you are using operator bool it will only be false when badbit
and or failbit
is set. The first time you close the file and evaluate operator bool none of those are set so the operator returns true. Calling close()
on the stream a second time will fail since it is already closed and since the function fails the failbit
is set. The next time you evaluate the stream using operator bool it returns false.
NathanOliver 429 Veteran Poster Featured Poster
NathanOliver 429 Veteran Poster Featured Poster
NathanOliver 429 Veteran Poster Featured Poster
ddanbe commented: extensive advise. +15
NathanOliver 429 Veteran Poster Featured Poster
NathanOliver 429 Veteran Poster Featured Poster
NathanOliver 429 Veteran Poster Featured Poster
rubberman commented: I knew, but forgot about that. Thanks. +13
triumphost commented: Lol. I like this quote. Stealing it! +8
TObannion commented: That's what I was looking for. As for "f", it's just an extra value to demonstrate when the stack is full. Thanks so much! +0