#include #include #include #include int main() { char **strings; struct dirent *entry; DIR *tDir; int i = 0; strings = malloc(sizeof(char**)); tDir = opendir("/home/madlax"); while (entry = readdir(tDir)) { if (entry->d_type != 4 || strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) continue; i++; strings = realloc(strings, sizeof(char*)*i); strings[i] = entry->d_name; } closedir(tDir); return 0; }