ilw 0 Newbie Poster

Hi

I'm trying to write a program that will work with kazaa dat files (ie the files where kazaa stores the downloaded file). Basically my problem is that i need to check if a 10MB chunk of the file has been downloaded, however kazaa stores what it has downloaded in the format:
Chunk start position and size of chunk downloaded
and the chunks areen't necessarily in the correct order. Also the chunk sizes and start positions can be fairly random.
So it might look a little like this:
0, 100 (so first 100 bytes there)
100, 100 (2nd 100 bytes there)
210, 175 (so bytes 200 - 210 are missing
485, 115
385, 100
etc

I either need to know which chunks are all there or the reverse ie which bits are missing. Does anyone have any ideas or know anywhere where i might be able to find an algorithm that could do this. My only idea was to do a bubble sort and then go through check if the end of one is the beginning of the next, but since the start position and chunk size are stored in different arrays i couldn't see how that could be done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.