Search code examples
clinuxglob

How are the results from glob ordered?


I am reading files in a directory using :

glob_t* globlist;
// initialization.
glob(pattern, GLOB_ERR | GLOB_BRACE, NULL, globlist);

This works well, but now the order of processing for each file is relevant, so I would like to know if there is a specific ordering for the matches, or if there is none, if it is possible to specify in some way.


Solution

  • As quoted from the man page here

    The pathnames shall be in sort order as defined by the current setting of the LC_COLLATE category;