Reputation: 22890
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.
Upvotes: 1
Views: 71
Reputation: 158499
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;
Upvotes: 1
Reputation: 409196
By default glob
sort the returned names.
From the POSIX reference page:
GLOB_NOSORT
Ordinarily, glob() sorts the matching pathnames according to the current setting of the LC_COLLATE category; see XBD LC_COLLATE. When this flag is used, the order of pathnames returned is unspecified.
Upvotes: 1