Programming and posix - April 2002
April 3, 2002
Solution Symposium
Page 36
hp e3000
programming
and posix
file management - lseek()
• off_t lseek (int fildes, off_t offset, int whence);
• changes the current file position
• returns the new file offset or -1 if error
• offset - number of bytes
• whence - how the offset is applied to the current
position:
– SEEK_SET - Set new offset to offset.
– SEEK_CUR - Set new offset to offset plus the
current offset.
– SEEK_END - Set new offset to offset plus the
current file size.