CFileItemList fileList; // assume we have populated this list with files fileList.Sort(CFileItemList::SORT_BY_NAME); // sort by file name for (int i = 0; i < fileList.GetSize(); i++) { CString fileName = fileList.GetItem(i)->GetFileName(); // do something with sorted file name }In this example, we first create a list of files called fileList. We then call the Sort function on this list and pass in the parameter for sorting by name. Finally, we loop through the sorted list and retrieve the file names, which can then be used for further processing. The package/library used for this example is the MFC (Microsoft Foundation Classes) which is part of the Visual C++ development environment.