Re: how to sort data in txt file
Create a structure to hold each line of data, then create a list of the structures and sort the list. Then write each of the structures contents sequentially to a file.
Optionally, you could do basically the same as above but implement the IComparable interface on the structures you created to hold the data and use the List<T>.Sort() method to sort the data based on the code you placed in the CompareTo() method implementation in each structure object.
R.I.P. 3.5" Floppy Drives
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein