getting folder content C language
How can 开发者_StackOverflowi get the paths of a folder and its content. Say i have folder named MyFolder as
/tmp/MyFolder/ where it has subfolders SubFolder1, SubFolder2... and some files
You may take a look at the opendir()
family functions.
A more efficient way than {open,read,close}dir() is Linux' getdirentries() function. See getdirentries(3) for details.
Use dirent and dir structures. You can use opendir(), readdir() etc for manipulation.
readdir() will give one name at a time and you can keep calling it iteratively.
精彩评论