#include<sys/types.h> #include<dirent.h> DIR *dirptr = NULL; struct dirent *entry; dirptr = opendir("/cache/recovery/"); EL ("/cache/recovery"); if(dirptr == NULL) { EL ("opendir failed "); return NULL; } else { EL ("opendir success ! "); while (entry = readdir(dirptr)) { printf("%s \n", entry->d_name); } closedir(dirptr); return NULL; }
稳定、高效、健壮