Once an input stream has failed, it is very hard to "unfail" it. You can clear the failbit and take your chances, but that is pretty useless in practice. If you cannot tolerate failure, read the input file as a sequence of strings and then parse the strings.
Source: wiktionary