Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
lseek
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The lseek function moves the file pointer associated with <handle>
to a new location that is <offset> bytes from <origin>. The next
operation on the file occurs at the new location. The <origin>
argument must be one of the following constants (defined in
STDIO.H): SEEK_SET, SEEK_CUR, or SEEK_END.
The lseek function can be used to reposition the pointer anywhere
in a file. The pointer can also be positioned beyond the end of
the file. However, an attempt to position the pointer before the
beginning of the file causes an error.
Return Value
The lseek function returns the offset, in bytes, of the new
position from the beginning of the file. A return value of -1L
indicates an error, and errno is set to either EBADF or EINVAL.
On devices incapable of seeking (such as terminals and printers),
the return value is undefined.
-♦-