*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> lseek (2)              
Title
Content
Arch
Section
 

lseek(2)

Contents


NAME    [Toc]    [Back]

       lseek - Move read-write file offset

SYNOPSIS    [Toc]    [Back]

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

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

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       lseek(): XSH4.0, XSH4.2, XSH5.0, XNS4.0, XNS5.0

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies  a  file  descriptor  obtained from a successful
       open() or fcntl() function.  Specifies a value, in  bytes,
       that  is  used in conjunction with the whence parameter to
       set the file pointer. A negative value causes  seeking  in
       the  reverse  direction.  The  resulting file position may
       also be negative.  Specifies how to interpret  the  offset
       parameter  in setting the file pointer associated with the
       filedes parameter.  Values for the whence  parameter  are:
       Sets  the  file pointer to the value of the offset parameter.
  Sets the file pointer to its current  location  plus
       the  value of the offset parameter.  Sets the file pointer
       to the size of the file  plus  the  value  of  the  offset
       parameter.

DESCRIPTION    [Toc]    [Back]

       The  lseek()  function  sets  the file offset for the open
       file specified by the filedes parameter. The whence parameter
 determines how the offset is to be interpreted.

       The  lseek()  function  allows  the  file offset to be set
       beyond the end of existing data in the file.  If  data  is
       later  written at this point, subsequently reading data in
       the gap returns bytes with the value 0 (zero)  until  data
       is actually written into the gap.

       By  itself,  the lseek() function does not extend the size
       of the file.

RETURN VALUES    [Toc]    [Back]

       Upon successful completion, the resulting pointer location
       (the file offset), measured in bytes from the beginning of
       the file, is returned. If the lseek() function fails,  the
       file  offset  remains unchanged, a value of (off_t) - 1 is
       returned, and errno is set to indicate the error.







ERRORS    [Toc]    [Back]

       If the lseek() function fails,  the  file  offset  remains
       unchanged  and  errno  may  be set to one of the following
       values: The filedes parameter is not an open file descriptor.
   The  whence  parameter  is  an invalid value or the
       resulting file  offset  would  be  invalid.   The  filedes
       parameter is associated with a pipe (FIFO), a socket, or a
       multiplexed special file.

              The filedes  parameter  underlying  the  stream  is
              associated with a socket.

SEE ALSO    [Toc]    [Back]

      
      
       Functions: fcntl(2), fseek(3), open(2), read(2), write(2)

       Standards: standards(5)



                                                         lseek(2)
[ Back ]
 Similar pages
Name OS Title
AFreadmisc IRIX read from / write to / move logical read/write pointer for data in a miscellaneous chunk in an audio file
llseek Linux reposition read/write file offset
lseek NetBSD reposition read/write file offset
pread Linux read from or write to a file descriptor at a given offset
lseek OpenBSD reposition read/write file offset
seek NetBSD reposition read/write file offset
lseek FreeBSD reposition read/write file offset
lseek Linux reposition read/write file offset
lseek IRIX move read/write file pointer
lseek HP-UX move read/write file pointer; seek
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service