All pastes #792584 Raw Edit

Anonymous

public c v1 · immutable
·published 2007-11-21 15:22 UTC
rendered paste body
int listdir(char *path, char *filelist[]){    DIR *dp;    struct dirent *ep;    int num = 0;    /* open directory for reading */    if ((dp = opendir(path)) != NULL) {        while ((ep = readdir(dp))) {            filelist[num] = ep->d_name; /* add entry to file list */            num++;        }        closedir(dp);    } else {        perror("Error opening directory");        return 0;    }    return num;}