-
1. Re: How do I know if this variable is a file handle?
WolfShade Jul 27, 2012 11:34 AM (in response to Adam Cameron.)Since "file = fileOpen(filePath)", can't you just remove the "file = ''" and check to see "if file" in the finally part?
^_^
-
2. Re: How do I know if this variable is a file handle?
Adam Cameron. Jul 27, 2012 11:45 AM (in response to WolfShade)That would just defer the issue.. fileOpen() doesn't return a boolean, so I can't go:
if (fileOpen(filePath)){
fileClose(file);
}
fileOpen() returns a file object; or nothing if it fails. The whole thing is to identify whether it's a file. That's the question.
As per my original, it's dead easy to work around, provided one leverages known side effects of the situation (original variable state; that if it's a file it exposes some public properties; that one can doa getClass() on it via Java, etc), but one shouldn't have to work around something as fundamental as this. So I was wondering if I had missed something.
Seemingly not (based on feedback I've had from various quarters).
--
Adam


