fstream EOF unexpectedly throwing exception
问题 My question is very similar to a previous one. I want to open and read a file. I want exceptions thrown if the file can't be opened, but I don't want exceptions thrown on EOF. fstreams seem to give you independent control over whether exceptions are thrown on EOF, on failures, and on other bad things, but it appears that EOF tends to also get mapped to the bad and/or fail exceptions. Here's a stripped-down example of what I was trying to do. The function f() is supposed to return true if a