On vendredi 26 septembre 2008, Almanova Sistemi wrote: > I need to lock the file to avoid writing by another user in multiuser > environment >
Sorry for that, the documentation is completely false. But who wrote it? :-) The LOCK instruction does not lock a specific stream not a stream, but instead use a specific path to create a global system lock. You use it this way: DIM hFile AS File TRY hFile = LOCK "~/lock" IF ERROR THEN PRINT "Already locked by something else!" ELSE PRINT "Got locked!" ... UNLOCK hFile ENDIF Do not rely on the lock file contents. It is truncated to zero byte when the lock is acquired. Regards, -- Benoit Minisini ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user