in reply to Check whether a file is open

You mean by another program?
As far as i know, you can't.
But as a workaround, try to open the file exlusive, if it fails, it's probably opened.

In your own program, try using flock

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

Replies are listed 'Best First'.
Re^2: Check whether a file is open
by Roy Johnson (Monsignor) on Jun 02, 2005 at 11:16 UTC
    To see if it's opened by your own program, use fileno. [Update] Of course, you use fileno on handles rather than on filenames, which is probably not what the OP wants to do. (thanks, tlm)

    Caution: Contents may have been coded under pressure.