lock
Locks a portion of a file
#include <nwfileio.h>
int lock (
int fildes,
LONG offset,
LONG length);
Returns a value of 0 if successful, and a value of -1 when an error occurs.
If an error occurs, errno is set to:
lock locks the amount of data specified by the length parameter in the file specified by the handle parameter, starting at the byte specified by the offset parameter in the file.
lock prevents other open handles from reading or writing into the locked region until an unlock has been done for this locked region of the file. All locked regions of a file must be unlocked before a file is closed.