lock()                   Set File Sharing Locks
 
 #include   <io.h>
 
 int        lock(handle,offset,length);
 int        handle;                      Handle associated with file
 long       offset;                      Location of area to be locked
 long       length;                      Length of area to be locked
 
    lock() locks an area of the file associated with 'handle', starting
    at the position 'offset' and proceeding for 'length' bytes.  Locking
    bytes in a file prevents subsequent reading and writing of those
    bytes by other processes.  No overlapping regions can be locked.  A
    program trying to read or write into a locked region will retry the
    operation three times.  If all three retries fail, the call fails
    with an error.
 
    lock() must be removed before closing a file.  A program must release
    all locks before completing.
 
    Returns:    0 is returned on success; -1 is returned on error.
 
      Notes:    lock() is unique to MS-DOS 3.x.  Older versions do not
                support this call.

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster