Programming and posix - February 2001
February 10, 2001
Solution Symposium
Page 35
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.