dosseek
Purpose
Moves the DOS file read/write pointer.
Library
DOS Services Library (libdos.a)
Syntax
#include <dos.h>
int dosseek (dosfile, offset, whence)
DOSFILE dosfile;
long offset;
int whence;
Description
The dosseek subroutine moves the current position pointer
in the file specified by the dosfile parameter.
o If the whence parameter is 0, the pointer is set to
the position specified by the offset parameter.
o If the whence parameter is 1, the pointer is incre-
mented by the number of bytes specified by the offset
parameter.
o If the whence parameter is 2, the pointer is set to
the size of the file plus the number of bytes speci-
fied by the offset parameter.
If the dosseek subroutine has been issued on a file that
was opened with the DO_ASCII flag set, the offset param-
eter must be 0. Otherwise, the results are unpredict-
able.
Return Value
Upon successful completion, the file pointer value is
returned. If the dosseek subroutine fails, a value of -1
is returned and doserrno is set to indicate the error.
Diagnostics
The dosseek subroutine fails and the file pointer remains
unchanged if one or more of the following are true:
EBADF dosfile is not an open file descriptor.
ESPIPE dosfile is associated with a pipe or FIFO.
EINVAL whence is not 0, 1 or 2. This also causes a
SIGSYS signal.
EINVAL The resulting file pointer would be negative.
Related Information
In this book: "DOS services library," "doscreate,"
"dosdup," and "dosopen."