Originally Posted by
Adak
You can make this as complicated and or elegant as you want, but there is no need to malloc a dam thing here, to simply do the job.
Use a static 2D array, and you don't give a crap about wasting some memory - you're not going to need to store the whole bloody text in RAM, anyway.
(If you do want to store the entire text in RAM, then you WILL want an array of pointers, otherwise, you don't need them).
Store a "chunk", sort it, write it out, and repeat. No malloc, no array of pointers (lovely as they are).
You can do this rather simply, and I'd recommend it.