Hi Karen,

<snip>
use strict;
use warnings;

use Fcntl qw(:flock);

open(F,"somefile.txt") || die $!;
flock(F,LOCK_EX);
# do stuff with F
flock(F,LOCK_UN);
close(F);
</snip>

If you're on windoze, don't expect it to work with 9x.

Regards

Toby

-----Original Message-----
From: Karen Liew Ying Ping [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 05, 2002 1:32 PM
To: [EMAIL PROTECTED]
Subject: Lock file


Hi,

is it possible to lock a file after opening it (exclusively) and prevents
another person to open it?

and the person can only open it after the 1st person has closed it.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to