[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _fsSeek()
 Reposition the pointer within a file
------------------------------------------------------------------------------
 C Prototype

     #include "filesys.api"
     ULONG _fsSeek(
                       FHANDLE hFileHandle,
                       LONG lOffset,
                       USHORT uiMode
                     )

 Arguments

     hFileHandle is a valid DOS reference to the file to be repositioned.

     lOffset is the memory location to set the file pointer to.

     uiMode specifies the starting point for the seek.  The following
     constants are defined for uiMode:

     File Mode Flags
     ------------------------------------------------------------------------
     Constant       Flag      Description
     ------------------------------------------------------------------------
     FS_SET         0x0000    Seek from beginning of file
     FS_RELATIVE    0x0001    Seek from current file pointer
     FS_END         0x0002    Seek from end of file
     ------------------------------------------------------------------------

 Returns

     _fsSeek() returns the new file pointer position.

 Description

     This function repositions the file pointer in the file whose handle is
     specified by hFileHandle.  The file pointer is positioned based on
     lOffset and uiMode.  This function is equivalent to the CA-Clipper
     function FSEEK().  If an error occurs, _fsError() will return the number
     of the error.

 Examples

     .  The following example uses _fsSeek() to determine the size of
        a file by seeking to the end:

        #include "filesys.api"

        ULONG FileSize( BYTEP fpFileName )
        {

           FHANDLE hFile;
           ULONG ulSize = 0;

           hFile = _fsOpen( "Foo", FO_READWRITE | FO_EXCLUSIVE );

           // Check for an open error before using the file
           if (! _fsError() )
           {
              // Determine size by seeking to EOF
              ulSize = _fsSeek( hFile, 0, FS_END );

              _fsClose( hFile );
           }

           return (ulSize);
        }

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


See Also: _fsClose() _fsCreate() _fsError() _fsOpen()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson