HP 3000 Manuals

lseek [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Library Reference Manual

lseek 

Moves the file position indicator.

Syntax 

     #include <unistd.h>
     long lseek (int fildes, long offset, int whence);

Parameters 

filedes       An open file descriptor.

offset        The number of bytes to move the current file position
              indicator, according to the method defined by whence.

whence        The starting point for the seek operation.  The possible
              values are:

              SEEK_SET      Seek relative to the beginning of file.

              SEEK_CUR      Seek relative to the current location in the
                            file.

              SEEK_END      Seek relative the end of file.

Return Values 

>=0           The resulting file position indicator location, as measured
              in bytes from the beginning of the file.

-1            An error occurred and errno is set to one of the following
              values:

              EBADF         The fildes parameter is not an open file
                            descriptor.

              EINVAL        The whence parameter is not 0, 1 or 2.

              EINVAL        The resulting file position indicator would
                            be negative.

              ESEEK         The fildes parameter does not refer to a file
                            that supports seeking.

              ESYSERR       A call to a system intrinsic failed.

Description 

The lseek function repositions the file position indicator associated
with fildes.

Some devices are incapable of seeking.  The value of the file position
indicator associated with such a device is undefined.
[REV BEG]


NOTE If linking with the POSIX/iX library, refer to the description of lseek() located in the MPE/iX Developer's Kit Reference Manual.
[REV END] See Also open(), dup()


MPE/iX 5.0 Documentation