#include <stdio.h> #include <sys/types.h> #include <dirent.h> int main(void) { DIR *dp; struct dirent *ep; dp = opendir ("./"); if (dp != NULL) { while ((ep = readdir (dp)) != NULL) { printf("%s %d\n", ep->d_name, ep->d_type); } (void) closedir (dp); } else { perror ("Couldn‘t open the directory"); } return 0; }
时间: 2024-12-28 14:01:16