On Fri, 11 Apr 2008 11:16:49 -0700, sherifffruitfly
<sh*************@gmail.comwrote:
Good enough - I just typically shy away from "exception-based
programming", so I thought I'd see if there were another common way.
Not that I know of. Exceptions are expensive, granted. But so is file
i/o. :)
In any case, logically if you are going to need access to the file anyway,
it doesn't do you any good to check the file's status beforehand, since
the status could change between the time you check and the time you try to
use the file.
Even if the file's accessible, it might not be by the time you try to use
it. And even in the situation where checking first could theoretically
save you the cost of the exception, now you've got the potential for a
false negative; that is, the check could fail even though by the time you
try to use the file, you could have succeeded.
Pete