Name
Unlock Procedure
Class
Microsoft.VisualBasic.FileSystem
Syntax
Unlock(filenumber[, record) Unlock(filenumber[,fromrecord[, torecord]])
-
filenumber Use: Required
Data Type: Integer
Any valid file number
-
record Use: Required
Data Type: Long
The record or byte number at which to commence the lock
-
fromrecord Use: Required
Data Type: Long
The first record or byte number to lock
-
torecord Use: Required
Data Type: Long
The last record or byte number to lock
Description
Use the Unlock procedure in situations where
more than one part of your program may need read and write access to
the same data file. The Unlock procedure removes
a lock that the Lock procedure placed on a
section of the file or the whole file.
Rules at a Glance
Use the
Unlockprocedure only with thefilenumberparameter to unlock the whole file.The
Unlockprocedure unlocks an entire file opened in Input or Output (sequential) mode, regardless of therecord,fromrecord, ortorecordarguments.Records and bytes in a file are always numbered sequentially from 1 up.
To unlock a particular record, specify its record number as
record, and only that record will be unlocked.To unlock a range of bytes (in a binary file) or of records (in a random file), indicate the starting position as
fromrecordand the ending position astorecord.
Programming Tips and Gotchas
You must take care to remove all file locks using the
Unlockprocedure before either closing a file or ending the application; otherwise, you can leave the file in an unstable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access