Tutorial: Learn To Sort A Text File On Windows With C++
February 15, 2021
In C++ Builder sorting text string lines is very easy by setting Sorted property of a StringList to true. This example below sorts a given text file and saves as sorted in same name.
void sort_textfile(UnicodeString filename)
{
auto str_list = new TStringList;
str_list->LoadFromFile(filename);
str_list->Sorted = true;
str_list->SaveToFile(filename);
…