IPB
>  Man Pages > Linux > Suse Linux 10.1 > Section 2 > lseek man page

lseek man page

Section 2 - Suse Linux 10.1 Man Pages

Other operating system man pages available here


Advanced Search

Hopefully, this page is exactly what you are looking for, but if not, you can always find further assistance on Unix/Linux Forum!


LSEEK(2)                   Linux Programmer's Manual                  LSEEK(2)




NAME

       lseek - reposition read/write file offset


SYNOPSIS

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

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


DESCRIPTION

       The lseek() function repositions the offset of the open file associated
       with the file descriptor fildes to the argument offset according to the
       directive whence as follows:

       SEEK_SET
              The offset is set to offset bytes.

       SEEK_CUR
              The offset is set to its current location plus offset bytes.

       SEEK_END
              The offset is set to the size of the file plus offset bytes.

       The lseek() function allows the file offset to be set beyond the end of
       the file (but this does not change the size of the file).  If  data  is
       later written at this point, subsequent reads of the data in the gap (a
       "hole") return null bytes ('\0') until data is  actually  written  into
       the gap.


RETURN VALUE

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


ERRORS

       EBADF  fildes is not an open file descriptor.

       EINVAL whence is not  one  of  SEEK_SET,  SEEK_CUR,  SEEK_END;  or  the
              resulting  file offset would be negative, or beyond the end of a
              seekable device.

       EOVERFLOW
              The resulting file offset cannot be represented in an off_t.

       ESPIPE fildes is associated with a pipe, socket, or FIFO.


CONFORMING TO

       SVr4, POSIX, 4.3BSD


RESTRICTIONS

       Some devices are incapable of seeking and POSIX does not specify  which
       devices must support it.

       Linux  specific  restrictions:  using  lseek()  on a tty device returns
       ESPIPE.


NOTES

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

       When converting old code, substitute values for whence with the follow-
       ing macros:


        old       new
       0        SEEK_SET
       1        SEEK_CUR
       2        SEEK_END
       L_SET    SEEK_SET
       L_INCR   SEEK_CUR
       L_XTND   SEEK_END

       SVR1-3 returns long instead of off_t, BSD returns int.

       Note that file descriptors created by dup(2) or fork(2) share the  cur-
       rent  file position pointer, so seeking on such files may be subject to
       race conditions.


SEE ALSO

       dup(2), fork(2), open(2), fseek(3), lseek64(3), posix_fallocate(3)



Linux                             2001-09-24                          LSEEK(2)


Man(1) output converted with man2html and wrapped by fishsponge

This page was generated on Tue Feb 13 02:17:34 GMT 2007

Your favourite pages:

No pages logged yet.
Trying to save cookie...

Top 10 most popular pages:

sqlite3 man page (5323 hits)
(openSUSE 10.2)

svn man page (5169 hits)
(FreeBSD 6.2)

adv_cap_autoneg man page (4865 hits)
(Solaris 10 11_06)

CPAN man page (4602 hits)
(Suse Linux 10.1)

ssh man page (4337 hits)
(Suse Linux 10.1)

ssh-socks5-proxy-connect man page (2840 hits)
(Solaris 10 11_06)

netcat man page (2687 hits)
(Suse Linux 10.1)

pprosetup man page (2472 hits)
(Solaris 10 11_06)

startproc man page (2452 hits)
(Suse Linux 10.1)

signal man page (2393 hits)
(Suse Linux 10.1)

Useful Links

Go Back

Visitor Statistics


Valid XHTML 1.0 Transitional     Valid CSS!

Partners: Cambridge Plus :: Pyrenees Lift Passes :: SolidWorks 3D CAD :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum