2 Answers
2

Whether you use formatted input or unformatted input diesn't matter either. Also, good() is generally not that useful aabd eof() is only useful to suppress an error message: if you read failed it may be OK that it failed because you read all the data. It is never a useful condition to determine whether a read was successful: eof() can yield true although the read was successful.