Iseek c or c++
hi
i forgot to mention that i execute this code in unix how iseek function work? for example, if i execute this code: read(fd,BUFFER,1024) ISEEK(fd,1024,SEEK_SET) read(fd,BUFFER,1024) ISEEK(fd,1024,SEEK_SET) read(fd,BUFFER,1024) which byte i will read in the second read func? the start byte will be 1024? or the start byte will be 2048? and also in the third read func: i will read the 2048 byte? or 3056 byte or the 1024 byte? thanks alot |
Assuming ISEEK is a macro invoking lseek, using SEEK_SET sets the pointer to 1024 (0 offset), so byte 1024 will be the one read in both cases.
|
ok thanks you!
|
hi
there is something that i still dont sure about it: the SEEK_SET flag is takes me to the absolute offset relativly from the start of of the file? or relatively from the last iseek? or relatively from the last read? can someone give me detal explanation? i will be happy for examples too thanks alot! |
From the manpage on lseek:
Code:
SEEK_SET |
Quote:
Quote:
Quote:
What does the word offset refer to (just the one I marked in red, not the other)? If you don't understand that use of offset is implicitly relative to the start of the file, then that man page quote doesn't really answer ofer4's question. Quote:
Quote:
In some fonts it might be easy to misread lseek as Iseek, then if you are careless about upper/lower case you might get iseek or ISEEK. |
thanks alot you both!
also, i am sorry, i meant "lseek" thanks alot johnsfine for the detailed explanation! |
All times are GMT -5. The time now is 12:57 AM. |