RTEMS Logo

RTEMS 4.7.99.2 On-Line Library


Input and Output Primitives Manager lseek - Reposition read/write file offset

PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

5.4.8: lseek - Reposition read/write file offset

CALLING SEQUENCE:

#include <sys/types.h>
#include <unistd.h>

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

STATUS CODES:

EBADF
Fildes is not an open file descriptor.
ESPIPE
Fildes is associated with a pipe, socket or FIFO.
EINVAL
Whence is not a proper value.

DESCRIPTION:

The lseek function repositions the offset of the file descriptor fildes to the argument offset according to the directive whence. The argument fildes must be an open file descriptor. Lseek repositions the file pointer fildes as follows:

The lseek function allows the file offset to be set beyond the end of the existing end-of-file of the file. If data is later written at this point, subsequent reads of the data in the gap return bytes of zeros (until data is actually written into the gap).

Some devices are incapable of seeking. The value of the pointer associated with such a device is undefined.

NOTES:

NONE


PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

Copyright © 1988-2004 OAR Corporation