I\'m getting a list of files on a linux-like system using opendir/readdir. It appears that the directory entries are returned in alphabetical order of file name. However, I
It's explicitly not guaranteed. The ordering often follows some rules, but the rules are complicated enough that you should not rely on them. The ordering may, for example, be affected by other operations happening in the same directory, and you can't control those. Treat the ordering as random, and sort things yourself if you need to.