Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lseek(2) — posix — mips UMIPS RISC/os 4.52

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dup(2)

open(2)



LSEEK(2-POSIX)      RISC/os Reference Manual       LSEEK(2-POSIX)



NAME
     lseek - reposition read/write file offset

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

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

DESCRIPTION
     The descriptor fildes refers to a file or device open for
     reading and/or writing.  lseek sets the file offset for the
     open file description associated with fildes as follows:

          If whence is SEEK_SET, the file offset is set to offset
          bytes.

          If whence is SEEK_CUR, the file offset is set to its
          current location plus offset.

          If whence is SEEK_END, the file offset is set to the
          size of the file plus offset.

     Symbolic constants SEEK_SET, SEEK_CUR and SEEK_END are
     defined in <unistd.h>.

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

     lseek allows the file offset to be set beyond the end of
     existing data in the file.  If data is later written at this
     point, subsequent reads of data in the gap return zero
     valued bytes until data is actually written into the gap.

RETURN VALUE
     Upon successful completion, lseek returns the resulting
     offset location as measured in bytes from the beginning of
     the file.  Otherwise, a value of ((off_t-1) is returned with
     errno set to indicate the error, and without changing the
     file offset.

ERRORS
     lseek will fail and the file offset will remain unchanged
     if:

     [EBADF]             fildes is not an open file descriptor.

     [ESPIPE]            fildes is associated with a pipe or
                         FIFO.



                         Printed 1/15/91                   Page 1





LSEEK(2-POSIX)      RISC/os Reference Manual       LSEEK(2-POSIX)



     [EINVAL]            whence is not a proper value.

SEE ALSO
     dup(2), open(2).

WARNING
     This document's use of whence is incorrect English, but
     maintained for historical reasons.















































 Page 2                  Printed 1/15/91



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026