[Gambas-user] How to lock a file

Almanova Sistemi almanova at ...1228...
Wed Sep 24 15:40:53 CEST 2008


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





More information about the User mailing list