c++ - Listing only folders in directory -


i'm creating game , must list folders in directory. tried using posix, , works correctly, how can identify whether found item folder?

you use opendir() , readdir() list directories , subdirectories. following example prints subdirectories inside current path:

#include <dirent.h> #include <stdio.h>  int main() {     const char* path = ".";      dir *dir = opendir(path);      struct dirent *entry = readdir(dir);      while (entry != null)     {         if (entry->d_type == dt_dir)             printf("%s\n", entry->d_name);          entry = readdir(dir);     }      closedir(dir);      return 0; } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -