Reposition a file descriptor's file pointer
Long_Type lseek (FD_Type fd, Long_Type ofs, int mode)
The lseek function repositions the file pointer associated
with the open file descriptor fp to offset ofs
according to the mode parameter. Specifically, mode must be
one of the values:
SEEK_SET Set the offset to ofs
SEEK_CUR Add ofs to the current offset
SEEK_END Add ofs to the current file size
Upon error, lseek returns -1 and sets errno. If
successful, it returns the new filepointer offset.
Not all file descriptors are capable of supporting the seek
operation, e.g., a descriptor associated with a pipe.
By using SEEK_END with a positive value of the ofs
parameter, it is possible to position the file pointer beyond the
current size of the file.
|