Hi listers,
What would be a smart way to test if a file is open ?
I've used the following script, but it's clumsy.
Thanks
#!perl -w
# topen: test if file (filehandle) open
# call: topen ($fh); return: 0 closed, >0 (=1+tell) open
use strict;
sub topen {local $^W = 0; # cut diags
return 1 +
At 21:50 +0200 2002.07.29, Louis Pouzin wrote:
>Hi listers,
>
>What would be a smart way to test if a file is open ?
>
>I've used the following script, but it's clumsy.
Perhaps this would be what you want? It depends on why you need to know;
if you are testing a file for reading, this would do i
Actually, that should do it, because the file is indeed in read mode when open.
Thanks a lot Chris.
On Mon, 29 Jul 2002 16:00:22 -0400, Chris Nandor wrote:
>Perhaps this would be what you want? It depends on why you need to know;
>if you are testing a file for reading, this would do it. For w
On Mon, 29 Jul 2002 21:50:42 +0200 (MEST), Louis Pouzin wrote:
>What would be a smart way to test if a file is open ?
Based on a filehandle? fileno().
--
Bart.