Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- GT_LIB v1.0 Reference Guide Release 1.0 - <b>lock a region of a low level file.</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 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

See Also: GT_FUNLOCK()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson