What causes the following while to terminate
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:8| Question number:3
All Answers
total answers (1)
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:8| Question number:3
total answers (1)
The condition of a stream is equivalent to
`!fail()`
, which means set either`failbit`
or`badbit`
will terminate the loop. For example, errors list below will terminate the loop:- System-level failure. (Set the
`badbit`
) Such as an unrecoverable r/w error.- Recoverable error. (Set the
`failbit`
) Such as reading a character when numeric data expected.- Reaching end-of-file. (Set both the
`eofbit`
and`failbit`
)