_llseek

  LONG _llseek(hFile, lOffset, nOrigin)    
  HFILE hFile; /* file handle */
  LONG lOffset; /* number of bytes to move */
  int nOrigin; /* position to move from */

The _llseek function repositions the pointer in a previously opened file.

Parameters

hFile

Identifies the file.

lOffset

Specifies the number of bytes the pointer is to be moved.

nOrigin

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 its current position.
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 if the function was successful. Otherwise, the return value is -1.

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.

This function is maintained for compatibility with previous versions of Windows. Win32 applications should use the SetFilePointer function to move a file's file pointer.

See Also

_lopen, SetFilePointer