Ok,that can be done quite easily if you know your file handling and a little bit of char manipulation.
If you want a tutorial on file handling then here is a link.
http://www.daniweb.com/techtalkforums/thread6542.html
Now here is an idea on how to do it.
1.First open the jumbled file
2.Open an output file
3.Read a line from the jumbled file
Now let the line be like:12 0000000XX0000XXXXXX
4.Get the line no (i.e 12) by copying the letter for the read line till you reach a space
5.If the number is the current line (i.e 1) then write to output file
6.Do this till all the lines are done and keep repeating the jumbled file reading.
Ok simple eh,but it's not too good or efficient but should do the job.Also to convert a char array which holds a num like "2324" into a int use atoi() (#include stdlib.h)
char char_num[] = "sdfsd";
int x = atoi(char_num);