closedir

Efficiently Traverse Directory Tree with opendir(), readdir() and closedir()

限于喜欢 提交于 2019-11-30 06:42:06
The C routines opendir(), readdir() and closedir() provide a way for me to traverse a directory structure. However, each dirent structure returned by readdir() does not seem to provide a useful way for me to obtain the set of pointers to DIR that I would need to recurse into the directory subdirectories. Of course, they give me the name of the files, so I could either append that name to the directory path and stat() and opendir() them, or I could change the current working directory of the process via chdir() and roll it back via chdir(".."). The problem with the first approach is that if the

Efficiently Traverse Directory Tree with opendir(), readdir() and closedir()

試著忘記壹切 提交于 2019-11-29 06:18:29
问题 The C routines opendir(), readdir() and closedir() provide a way for me to traverse a directory structure. However, each dirent structure returned by readdir() does not seem to provide a useful way for me to obtain the set of pointers to DIR that I would need to recurse into the directory subdirectories. Of course, they give me the name of the files, so I could either append that name to the directory path and stat() and opendir() them, or I could change the current working directory of the