LOCK: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 16: Line 16:
* [[LOCK]] and [[UNLOCK]] statements are always used in pairs and each statement must match the other one.
* [[LOCK]] and [[UNLOCK]] statements are always used in pairs and each statement must match the other one.
* Files must be unlocked using [[UNLOCK]] before other programs can access them, and before the file is closed.
* Files must be unlocked using [[UNLOCK]] before other programs can access them, and before the file is closed.
* '''[[Keywords currently not supported by QB64#Keywords not supported in Linux or macOS versions|Keyword not supported in Linux or macOS versions]]'''
* '''[[Keywords currently not supported by QB64#Keywords_not_supported_in_Linux_or_macOS_versions|Keyword not supported in Linux or macOS versions]]'''


 
=== QBasic/QuickBASIC ===
==QBasic/QuickBASIC==
* Required DOS '''SHARED.EXE''' to be run for QBasic to use networking access modes. No longer required.
* Required DOS '''SHARED.EXE''' to be run for QBasic to use networking access modes. No longer required.



Latest revision as of 02:03, 28 January 2023

The LOCK statement restricts access to parts of a file by other programs or processes.


Syntax

LOCK [#]fileNumber%
LOCK [#]fileNumber%, record&
LOCK [#]fileNumber%, [firstRecord&] TO lastRecord&


Description

  • fileNumber% is the file number of the file to lock.
  • In the first syntax, the entire file is locked.
  • In the second syntax, record& is the record number of the file to lock.
  • In the third syntax, the records or bytes in the range [firstRecord&,lastRecord&] are locked. If firstRecord& is omitted, it is assumed to be one (the first record or byte).
  • For files opened in BINARY mode, each record corresponds to a single byte.
  • LOCK and UNLOCK statements are always used in pairs and each statement must match the other one.
  • Files must be unlocked using UNLOCK before other programs can access them, and before the file is closed.
  • Keyword not supported in Linux or macOS versions

QBasic/QuickBASIC

  • Required DOS SHARED.EXE to be run for QBasic to use networking access modes. No longer required.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link