[Gambas-user] How to lock a file

Almanova Sistemi almanova at ...1228...
Fri Sep 26 23:07:48 CEST 2008


I need to lock the file to avoid writing by another user in multiuser
environment

nando ha scritto:
> Can you tell why you have to lock it..
> for what reason?
>
>
> ---------- Original Message -----------
> From: Almanova Sistemi <almanova at ...1228...>
> To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
> Sent: Wed, 24 Sep 2008 15:40:53 +0200
> Subject: [Gambas-user] How to lock a file
>
>   
>> Hi,
>>
>> I have a problem with LOCK
>>
>> I am writing an application in gambas (2.7.0-2.1) on opensuse 10.3 -
>> 11.0 and I need to lock a file after open it.
>>
>> My code:
>>
>> ...
>> DIM hfile as File
>> DIM sNameFile as String
>>
>> sNameFile = "SomeFile"
>>
>> hfile = OPEN sNameFile FOR INPUT OUTPUT
>> TRY LOCK hfile
>> IF ERROR then
>>     ...
>> ENDIF
>> LINE INPUT #hfile, MyVar
>> UNLOCK hfile
>> CLOSE #hfile
>> ...
>>
>> When I execute it I get the following messge:
>> Useless LOCK in line ...
>>
>> I obtain the same result also with:
>>
>> hfile = OPEN sNameFile FOR READ WRITE
>>
>> Why ?
>>
>> Regards,
>> Massimo.
>> -------------------------------------------------------------------------
>> 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 at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>> -------------------------------------------------------------------------
>> 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 at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>     
> ------- End of Original Message -------
>
>
> -------------------------------------------------------------------------
> 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>   




More information about the User mailing list