What kind of datafile? Random access or a text file? Do you you want to lock individual records, or the whole table. Do you want to lock the read or a write or both?
Hi David,
i use a random file. The problem i described is the use of table and file locking.
How can I check if a table or file is locked. (before writing)
containing the text name of who is editing it (has the file locked)
if the ~filename is found when attempting to open filename it opens ~filename reads the user
then returns the message: filename is locked for editing by user
This should give you an idea of what your pgm should look something like.
'beginning of pgm
on error goto 60000
.
.
.
'open file
inven = freefile
open "inventor.dat" for random shared as #inven len = 256
.
.
.
.
'get a record from the table and lock it
lock inven, recordnumber
get inven, recordnumber
'
'do some stuff
'
'write data back to file
put inven, recordnumber
'don't forget to unlock record
unlock inven, recordnumber
60000 if err = 63 or err = 70 then print "record locked - wait";: resume
'more error routines here
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.