01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

LSEEK ( 2) LSEEK ( 2 )<br />

NAME<br />

)seek - move read/write file pointer<br />

SYNOPSIS<br />

long )seek (fildes, offset, whence)<br />

int fildes;<br />

long offset;<br />

int whence;<br />

DESCRIPTION<br />

Fildes is a file descriptor returned from a creat, open, dup , or<br />

fcntl system call. Lseek sets the file pointer associated with fildes<br />

as follows:<br />

If whence is 0, the pointer is set to offset bytes.<br />

If whence is 1, the pointer is set to its current location<br />

plus offset.<br />

If whence is 2, the pointer is set to the size of the file plus<br />

offset.<br />

Upon successful completion, the resulting pointer location as measured<br />

in bytes from the beginning of the file is returned.<br />

Lseek will fail and the file pointer will remain unchanged if one or<br />

more of the following are true:<br />

Fildes is not an open file descriptor. ]EBADF]<br />

Fildes is associated with a pipe or fifo. ]ESPlPE]<br />

Whence is not 0, 1 or 2. ]EINV AL and SIGSYS signal]<br />

The resulting file pointer would be negative. ]EINVAL]<br />

Some devices are incapable of seeking. The value of the file<br />

pointer associated with such a device is undefined.<br />

RETURN VALUE<br />

Upon successful completion, a non-negative integer indicating the<br />

file pointer value is returned. Otherwise, a value of -1 is returned<br />

and errno is set to indicate the error.<br />

SEE ALSO<br />

creat(2), dup(2), fcntl(2), open(2).<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!