1. Naive Method
for (ii=0; ii<filesize; ii += stridelength)
2. Sparse files method
This is insanely quick compared to the method 1! The man page for lseek() explains this nicely:
"The lseek() function allows the file offset to be set beyond the end of the file (but this does not change the size of the file). If data is later written at this point, subsequent reads of the data in the gap (a "hole") return null bytes ('\0') until data is actually written into the gap.".Does this work on OSes other than Linux?