Unnamed
public text v1 · immutable#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <dirent.h>
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;
}