Lock a region of a low level file.
──────────────────────────────────────────────────────────────────────────────

Syntax

GT_FLock(<nHandle>,<nOffset>,<nLength>) --> lLocked

Arguments:

<nHandle> is a numeric file handle.

<nOffset> is the byte position at which the lock will start. This
is a zero based value.

<nLength> is the length of the region to lock.

Returns:

A logical value, .T. if the region was locked, .F. if not.

Description:

GT_FLock() can be used to lock a region of a low level file.

To use the low-level locking/un-locking functions you will first
need to open the file with fopen(), or perhaps create a file with
fcreate(). Once open you can use the file handle returned by
Clipper to carry out a lock.

When you have locked an area of the file, be sure to store the
offset and length, these values will be required by GT_FUnLock().


Examples:


#include "fileio.ch"

if (nFile := fopen("LIFE.42",FO_SHARED)) != F_ERROR

// Lock a region in the file at position 10 (don't forget,
// the offset starts at 0, not 1!

if GT_FLock(nFile,10,2)

// Make some changes to the file.

GT_FUnLock(nFile,10,2)
endif
fclose(nFile)
endif


Source: LLFLOCK.C

Author: Dave Pearson