You need to go through the file and get the byte position of each %tage point of the file - ie, 1%, 2%, 3% (in time terms) then convert this to 256ths of the file length: this is the index.

Also, you fill in the length in frames (ie, time) & that sort of thing. You scan the whole file and update the small header on the front of it.

Hugo