I was actually not quite sure how to lseek() before writing this post myself.
#include <unistd.h>
#include <fcntl.h>
int fd;
int main(){
fd = open("foo",O_WRONLY | O_CREAT, S_IRWXU);
lseek(fd, 0, SEEK_END);
write(fd,"abc\n",4);
}
See, the offset and whence value can be played around. I can do {SEEK_SET, SEEK_END} to get exactly the same result. :D
Anyway, it's nice to see OR operation on enum values.