SORT function

Blitz3D Forums/Blitz3D Beginners Area/SORT function

Dimas(Posted 2007) [#1]
I have a .txt file, with ascii lines of 5 characters each, and I want to sort it.

Currently I use (windows' sort):

----------------------------

ExecFile "sort "+pat$+ff$+" /o "+pat$+"t.txt":Delay 200:Repeat:Until FileType(pat$+"t.txt")=1

DeleteFile pat$+ff$:Delay 200:Repeat:Until FileType(pat$+ff$)=0

CopyFile pat$+"t.txt",pat$+ff$:Delay 200:Repeat:Until FileType(pat$+ff$)=1

DeleteFile pat$+"t.txt":Delay 200:Repeat:Until FileType(pat$+"t.txt")=0

--------------------

but sometimes it didnt work. Maybe the execute running on 2nd plane has something about it...

Has someone a function to short such a file or something I can use?


Dimas(Posted 2007) [#2]
it is something like

ExecFile "sort file.txt to file2.txt"
deletefile "file.txt"
copyfile "file2.txt","file.txt"
deletefile "file2.txt"


big10p(Posted 2007) [#3]
There's a load of sort functions in the code archives, I seem to remember.