Search code examples
cfile-descriptor

Read/write from file descriptor at offset


I've been using the read(2) and write(2) functions to read and write to a file given a file descriptor.

Is there any function like this that allows you to put an offset into the file for read/write?


Solution

  • Yes, you're looking for lseek.

    http://linux.die.net/man/2/lseek