Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!munnari!goanna!ajk From: ajk@goanna.oz (Alan Kent) Newsgroups: comp.sys.amiga Subject: AmigaDOS locks Message-ID: <798@goanna.oz> Date: Mon, 27-Apr-87 02:59:38 EDT Article-I.D.: goanna.798 Posted: Mon Apr 27 02:59:38 1987 Date-Received: Tue, 28-Apr-87 01:18:13 EDT Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 31 Keywords: locking files with amigados Please Enlighten me. I have been looking through all the manuals I can lay my hands on, but nothing seems to help. I want to lock a file so that no-one else will touch it while I do I/O on the file (reads and possibly writes). When I open it, it may only be for read access, but I might want to write to it later (to save a new version). I have tried Lock()ing the file for exclusive access, but then Open() wont work (because its locked). Doing the Open() first makes the Lock() fail. Is there any way of using Lock() to give myself exclusive access to a file and have it open at the same time for I/O? I want to make sure I dont allow the user to modify the memory version of a file if I cannot save it later! (I am writing a sort of editor). Obviously I dont want to write to the file if the user does not change it. At present, I exclusive Lock() the file and if that works, I quickly UnLock() and Open() it. This is not perfect but its the best I can think of. Anyone got any better ideas? Thanks in advance Alan Kent UUCP: {seismo,hplabs,mcvax,ukc,nttlab} Dept of Computing !munnari!goanna.oz!ajk Royal Melb. Inst. of Tech. ACSnet: ajk@goanna.oz 124 La Trobe St ARPA: munnari!goanna.oz!ajk@SEISMO.ARPA Melbourne, Victoria 3000 AUSTRALIA