Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!attctc!jolnet!caw From: caw@jolnet.ORPK.IL.US (Chris Wichura) Newsgroups: comp.sys.amiga Subject: Re: File sources Keywords: C, file manipulation, lock Message-ID: <2629@jolnet.ORPK.IL.US> Date: 1 Jan 90 01:20:55 GMT References: <[25985311:3493.1]com <405@dsoft.UUCP> Reply-To: caw@jolnet.UUCP (Chris Wichura) Organization: Jolnet, Public Access Unix, Orland Park (Joliet), Ill. Lines: 19 The Ados Lock() command in dos.library is really all you should need to get a lock on a file (it is not just for directories). If you go "lock = Lock("filename", ACCESS_READ)" you will get a shared lock on the file. Others can read it but no one else can write to it. If you go "lock = Lock("filename", ACCESS_WRITE)" you get an exclusive lock. You can read and write it, but no one else in the system can access it until you UnLock() it. Also, always remember to UnLock() locks you have obtained or you could keep the system from fully accessing a file and the only way to get access back is to reboot the system (unless someone has written a utility to UnLock specific locks [I forget if XOper has a function to do this]). -- Christopher A. Wichura u12401 @ uicvm.uic.edu (my home account) caw @ jolnet.UUCP (my Usenet feed)