[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
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.
See Also:
open()
unlock()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson