man(1) Manual page archive


     LSEEK(2)                                                 LSEEK(2)

     NAME
          lseek, llseek - seek, move read/write pointer

     SYNOPSIS
          long lseek(fildes, offset, whence)
          long offset;

          Long llseek(fildes, offset, whence)
          Long offset;

     DESCRIPTION
          Lseek and llseek set the file pointer for the file associ-
          ated with fildes as follows:

               If whence is 0, the pointer is set to offset bytes.

               If whence is 1, the pointer is set to its current loca-
               tion plus offset.

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

          The new file pointer value is returned.

          Type Long is a 64-bit quantity.

          Seeking far beyond the end of a file, then writing, creates
          a gap or `hole,' which occupies no physical space and reads
          as zeros.

     SEE ALSO
          open(2), fseek(3)

     DIAGNOSTICS
          EBADF, ESPIPE

     BUGS
          Lseek doesn't affect some special files.