About mmap and lseek
Posted on 2006-10-22
void * mf=mmap(0,n,PROT_READ,MAP_PRIVATE,f,0);
1)Am I right that using lseek(f,0,SEEK_END); to get the file size will give you filesize + 1, and hence it is more correct to use lseek(f,-1,SEEK_END);? Also, is this a correct way to get the filesize?
2)After getting mf, how should I read the file inside the memory map file?
eg my file has
How to get "line2 def", ie the second line?