:
repeat
: sorted:=true;
: for i:=1 to filesize(form3.vidvdfile) do
:
Are you sure filesize(form3.vidvdfile) return always the maximum index of videos - 1?
if it doesn't, there could be problems in the next line...
:
: if videos[i]<=videos[i+i] then
: begin
: sorted:=false;
:
: tempvideo:=videos[i];
: videos[i]:=videos[i+1];
: videos[i+1]:=tempvideo;
:
: temppointer:=pointers[i];
: pointers[i]:=pointers[i+1];
: pointers[i+1]:=temppointer;
: end;
: until sorted=true;
This is some kind of bubble-Sort. Sorting algorithms are well researched, I would suggest you search the Internet for it.
: the problem is that some of the array values contain a 0 and when the array compares a 0 with a 0 it keeps going.
Yes, your algorithm cannot deal with equal values... They get swapped over and over.
Easy fix: replace "less or equal" with "less than" in the comparison.
mfg
Thinker