Does readdir() guarantee an order?

前端 未结 7 1497
时光取名叫无心
时光取名叫无心 2020-11-27 18:50

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

7条回答
  •  盖世英雄少女心
    2020-11-27 19:19

    No, readdir does not guarantee any order.

    (Some file systems might store directory entries in a certain order, in such cases readdir might return them to you in the same order, but that's not a feature of readdir itself.)

提交回复
热议问题