lseek(fd, offset, SEEK_SET);
read(fd, buffer, LEN);
You can do this in one function call using pread(2) . The above code is equivalent with:
pread(fd, buffer, LEN, offset);
In a similar manner you can notice the existence of pwrite(2) which writes some data into a file at a given position.
No comments:
Post a Comment