When a case is expected to never happen, use ASSERT(0), not a throw. That way, if it does, we get a full crash dump. file.bad() is not equivalent to !file.good(); usually you want the latter (my bug)