gpt4 book ai didi

c - 使用 opendir() 获得的目录流中的条目顺序

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:24:59 25 4
gpt4 key购买 nike

可以对使用 opendir() 获得的目录流中条目的顺序做出任何假设吗?功能?例如,... 总是前两个条目吗?什么会导致订单发生变化?

最佳答案

Posix 表示您不能依赖 ... 作为前两个条目。

来自 The Open Group Base Specifications Issue 6 :

The directory entries for dot and dot-dot are optional. This volume of IEEE Std 1003.1-2001 does not provide a way to test a priori for their existence because an application that is portable must be written to look for (and usually ignore) those entries. Writing code that presumes that they are the first two entries does not always work, as many implementations permit them to be other than the first two entries, with a "normal" entry preceding them.

关于c - 使用 opendir() 获得的目录流中的条目顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9319909/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com