Suppose the file size is less than 10000, what will happen when blindly write (fd, "a", 1) ?
Code:fd=open(fname,O_RDWR|O_CREATE,0777); lseek(fd, 10000l, SEEK_SET); write (fd, "a", 1);
Suppose the file size is less than 10000, what will happen when blindly write (fd, "a", 1) ?
Code:fd=open(fname,O_RDWR|O_CREATE,0777); lseek(fd, 10000l, SEEK_SET); write (fd, "a", 1);
lseek doesn't appear in my standard. But this was the first Google hit for "lseek", and it seems pretty clear on the subject, if your lseek is the same as theirs.
Thanks, but my question is when the "offset" is too large, will lseek fail? will write fail? Or will they have ways to handle it? I don't have a linux machine at hand and can't check it.
I shouldn't do this, but since you couldn't be bothered to click on the bloody link I just provided, I will quote:
That still seems pretty clear on the subject.Originally Posted by IEEE and the Open Group