_llseek

Syntax

LONG _llseek(hFile,lOffset,iOrigin)

This function repositions the pointer in a previously opened file. The iOrigin parameter specifies the starting position in the file, and lOffset specifies how far (in bytes) the function is to move the pointer.

Parameter Type/Description  

hFile int Specifies the MS-DOS file handle of the file.  
lOffset LONG Specifies the number of bytes the pointer is to be moved.  
iOrigin int Specifies the starting position and direction of the pointer. The parameter must be one of the following values:  
  Value Meaning
  0 Move the file pointer lOffset bytes from the beginning of the file.
  1 Move the file pointer lOffset bytes from the current position of the file.
  2 Move the file pointer lOffset bytes from the end of the file.

Return Value

The return value specifies the new offset of the pointer (in bytes) from the beginning of the file. The return value is –1 if the function fails.

Comments

When a file is initially opened, the file pointer is positioned at the beginning of the file. The _llseek function permits random access to a file's contents by moving the pointer an arbitrary amount without reading data.