#include "scicurdir.h"
#include "md5.h"
#include "pathconvert.h"
+
+#include <wchar.h> // for wcscmp
+#include <stdlib.h> // for qsort
}
xmlTextWriterPtr openXMLFile(const wchar_t *_pstFilename, const wchar_t* _pstLibName);
void closeXMLFile(xmlTextWriterPtr _pWriter);
bool AddMacroToXML(xmlTextWriterPtr _pWriter, const std::wstring& name, const std::wstring& file, const std::wstring& md5);
+static int cmp(const void* p1, const void* p2);
/*--------------------------------------------------------------------------*/
wchar_t **pstPath = findfilesW(pstParsePath, L"*.sci", &iNbFile, FALSE);
+ // sort by name using C-style functions
+ qsort(pstPath, iNbFile, sizeof(wchar_t*), cmp);
+
if (pstPath)
{
return true;
}
+
+
+static int cmp(const void* p1, const void* p2)
+{
+ return wcscmp(* (wchar_t * const *) p1, * (wchar_t * const *) p2);
+}
+