delorie.com/djgpp/doc/libc/libc_548.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

lseek

Syntax

 
#include <unistd.h>

off_t lseek(int fd, off_t offset, int whence);

Description

This function moves the file pointer for handle fd according to whence:

SEEK_SET

The file pointer is moved to the offset specified.

SEEK_CUR

The file pointer is moved offset bytes relative to its current position.

SEEK_END

The file pointer is moved to a position offset bytes from the end of the file. The value of offset is usually nonpositive in this case.

Return Value

The new offset is returned, or -1 and errno set on failure.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

 
lseek(fd, 12, SEEK_CUR); /* skip 12 bytes */


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004