lseek man page on OPENSTEP

Man page or keyword search:  
man Server   1419 pages
apropos Keyword Search (all sections)
Output format
OPENSTEP logo
[printable version]


LSEEK(2)							      LSEEK(2)

NAME
       lseek - move read/write pointer

BSD SYNOPSIS
       #include <sys/file.h>

       #define L_SET 0	 /* set the seek pointer */
       #define L_INCR	 1 /* increment the seek pointer */
       #define L_XTND	 2 /* extend the file size */

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

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

       #define SEEK_SET	 0 /* set the seek pointer */
       #define SEEK_CUR	 1 /* increment the seek pointer */
       #define SEEK_END	 2 /* extend the file size */

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

DESCRIPTION
       The  descriptor	fd  refers to a file or device open for reading and/or
       writing.	 The lseek function sets the file pointer of fd as follows:

       (1)  If whence is L_SET (SEEK_SET for POSIX applications),  the	offset
	    is set to offset bytes.

       (2)  If	whence is L_INCR (SEEK_CUR for POSIX applications), the offset
	    is set to its current value plus offset bytes.

       (3)  If whence is L_XTND (SEEK_END for POSIX applications), the	offset
	    is set to the size of the file plus offset bytes.

       Upon  successful completion, the resulting pointer location as measured
       in bytes from beginning of the file  is	returned.   Some  devices  are
       incapable  of seeking.  The value of the pointer associated with such a
       device is undefined.

       Seeking far beyond the end of a file, then writing, creates  a  gap  or
       “hole”, which occupies no physical space and reads as zeros.  The lseek
       function does not, by itself, extend the size of the file.

RETURN VALUE
       Upon successful completion, the current file pointer value is returned.
       Otherwise,  a  value of -1 is returned and errno is set to indicate the
       error.

ERRORS
       The lseek function will fail and the file pointer will remain unchanged
       if:

       [EBADF]	      fd is not an open file descriptor.

       [ESPIPE]	      fd is associated with a pipe or a socket.

       [EINVAL]	      whence  is  not  a  proper  value, or the resulting file
		      offset is less than 0.

SEE ALSO
       creat(2), dup(2), fcntl(2), open(2), read(2), sigaction(2P), write(2)

				August 1, 1992			      LSEEK(2)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server OPENSTEP

List of man pages available for OPENSTEP

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net