<div dir="ltr"><div>You may want to edit copy of the file and then merge it back to the original. Otherwise you will create a mess, because user or some other program does not know what you did to the file.<br></div><div><br></div><div>Jussi<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 20, 2018 at 2:54 PM Hans Lehmann <<a href="mailto:hans@gambas-buch.de">hans@gambas-buch.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
this example can also be found in the documentation for LOCK <br>
(<a href="http://gambaswiki.org/wiki/lang/lock" rel="noreferrer" target="_blank">http://gambaswiki.org/wiki/lang/lock</a>):<br>
<br>
8<---------------------------------------------------------<br>
<br>
Dim hLock As Stream<br>
' Try to acquire the lock<br>
Try hLock = Lock "~/my-lock"<br>
If Error Then<br>
   Print "Locked is already acquired. Try again later."<br>
   Return<br>
Endif<br>
' File is locked, you can do the job now!<br>
...<br>
' Do not forget to release the lock<br>
Unlock hLock<br>
<br>
8<---------------------------------------------------------<br>
<br>
and this sentence:<br>
<br>
Beware that the locked file is emptied! So never use a file whose <br>
contents is important.<br>
<br>
Doesn't this sentence contradict the above example? I would like to <br>
protect the file I want to edit exclusively against competing parallel <br>
access by locking it? The file should not be emptied - I want to edit it!<br>
<br>
With kind regards<br>
<br>
Hans<br>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div>