typedef struct file{/*This is the struct to add*/
    char* fileNames;
}File;
File* scanDir(char *path,File file[],int i){/*Func works recursively*/
    DIR *dir;
    struct dirent *dp;
    char * file_name;
    dir = opendir(path);
    if(dir==NULL)
        return file;
    chdir(path);
    while ((dp=readdir(dir)) != NULL) {
        if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")){}
        else {
            file_name = dp->d_name; /*use it*/
            printf("file_name: \"%s\"\n",file_name);
            file[i]=create(file_name,file[i]);/*This create function adds the file name into the file struct*/
            i++;
            scanDir(dp->d_name,file,i);
        }
    }
    chdir("..");
    closedir(dir);
    return file;
}
I am trying to add file names to struct array. int i counts the array order. How can I read the files by adding to struct array?
