doslock
Purpose
Locks or unlocks a region in a DOS file.
Library
DOS Services Library (libdos.a)
Syntax
#include <dos.h>
int doslock (dosfile, offset, length, code)
DOSFILE dosfile;
int offset, length, code;
Description
The doslock subroutine provides a simple mechanism for
disallowing read/write access by other processes to the
file whose handle is specified by the dosfile parameter.
If code is L_LOCK, and no part of the region is already
locked by another process, then the region is locked. If
code is L_UNLOCK, and the exact region has already been
locked by the current process, then the region is
unlocked.
Return Value
If the doslock subroutine fails, a value of -1 is
returned and doserrno is set to indicate the error. For
L_LOCK, the error means that the lock failed, either
because the region was already locked, or because the
lock list is full. For L_UNLOCK, the error means that
the region was not locked.
Related Information
In this book: "DOS services library," "dosread," and
"doswrite."