VMS Help  —  CRTL  lseek  Description
    The lseek function can position a fixed-length record-access
    file with no carriage control or a stream-access file on any
    byte offset, but can position all other files only on record
    boundaries.

    The available Standard I/O functions position a record file at
    its first byte, at the end-of-file, or on a record boundary.
    Therefore, the arguments given to lseek must specify either
    the beginning or end of the file, a 0 offset from the current
    position (an arbitrary record boundary), or the position returned
    by a previous, valid lseek call.

    This function returns the new file position as an integer of type
    off_t which, like the offset argument, is either a 64-bit integer
    if _LARGEFILE is defined, or a 32-bit integer if not.

    For a portable way to position an arbitrary byte location with
    any type of file, see the fgetpos and fsetpos functions.

                                 CAUTION

       If, while accessing a stream file, you seek beyond the
       end-of-file and then write to the file, the lseek function
       creates a hole by filling the skipped bytes with zeros.

       In general, for record files, lseek should only be directed
       to an absolute position that was returned by a previous
       valid call to lseek or to the beginning or end of a file.
       If a call to lseek does not satisfy these conditions, the
       results are unpredictable.

    See also open, creat, dup, dup2, and fseek.
Close Help