Am 19.01.2010 10:57, schrieb Rolf-Werner Eilert: > Just tried to rewrite a function I used for locking files in my Gambas1 > apps. It was based on making a directory for locking, and it delivered a > Boolean about if locking was successful or not. Think of it this way: > > Private Function FileIsLocked(filename As String) As Boolean > > Now, when I tried to change the functional part so it uses LOCK instead > of my original mechanism, I get "Useless LOCK". Does this mean, LOCK can > only be used within an OPEN/CLOSE statement? Or maybe only directly > following an OPEN statement? That would be a shame, because this would > mean doing without my own function and including a lot of code into each > OPEN session anywhere it is needed. > > This wouldn't only blow up my code unnecessarily but also require me to > browse through all the places where file locking is used. > > Or did I get this error message wrong? > > Regards > > Rolf
Ok, sorry - I found out the reason for my confusion myself :-) I didn't have a look into the online documentation and got confused by the old description given in the installed docs. Isn't it possible to compile the online docs into the distributed ones automagically? It seems to run now, though I still have one question left: Is it correct to "open" the file twice, once for LOCK and once for OPEN? In other words: The LOCK statement produces its own stream for the lock file, this is what I understand from it. Then I will have to open it via another stream as usual for reading or writing or whatever. Or how do you use it? Rolf ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
