[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _fsLock()
 Lock or unlock a portion of a file
------------------------------------------------------------------------------
 C Prototype

     #include "filesys.api"
     BOOL _fsLock(
                       FHANDLE hFileHandle,
                       ULONG ulStart,
                       ULONG ulLength,
                       USHORT uiMode
                   )

 Arguments

     hFileHandle is a valid DOS reference to the file to be locked or
     unlocked.

     ulStart is the offset from the start of the file that specifies
     the starting location of the portion of the file to be locked or
     unlocked.

     ulLength is the number of bytes to lock or unlock.

     uiMode is a flag that specifies whether the file is to be locked or
     unlocked.  The following constants are defined for uiMode:

     File Lock Flags
     ------------------------------------------------------------------------
     Constant      Flag      Description
     ------------------------------------------------------------------------
     FL_LOCK       0x0000    Lock the region
     FL_UNLOCK     0x0001    Unlock the region
     ------------------------------------------------------------------------

 Returns

     _fsLock() returns a boolean value indicating success or failure of the
     specified operation.

 Description

     This function locks or unlocks a region of the file whose handle is
     specified by hFileHandle.  The region starts at offset ulStart and
     continues for ulLength bytes.  The flag uiMode specifies whether the
     area is to be locked or unlocked.  This function has no CA-Clipper
     equivalent.

 Examples

     .  The following code fragment illustrates the use of _fsLock()
        to both lock and unlock a part of the file:

        #include "filesys.api"

        FHANDLE hFile;

        hFile = _fsCreate( "Foo", FC_NORMAL );

        // Check for an open error before using the file
        if (! _fsError() )
        {
           if (_fsLock( hFile, 0, 1, FL_LOCK ) ) // Lock first byte
           {
              .
              .
              .
              _fsLock( hFile, 0, 1, FL_UNLOCK ); // Unlock first byte
           }
           .
           .
           .
              _fsClose( hFile );
        }

 Files  Library is CLIPPER.LIB, header file is Filesys.api.


This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson