i am writing a code which is as follows:

#include <stdio.h>

int main(void)
    char buffer[2500];
    FILE * myfile;
    myfile = fopen("/home/csgrads/akhan015/desktop/benchmark/coverage/test0/stmt.txt","r");
    while (!feof(myfile))
    return 0;

1.in this code i am accessing a folder to read a text file. this test0 folder is only 1 folder of the 1500 folders i have to read in which i have to open and compare 1500 txt files which are in test0... test1500. i can only access the text file through path( this is the only way i know to access the text file placed in a folder).please can someone tell how can i access 1500 folders in a loop or some other way. a code snippet would be really appreciated.

2.for each of 1500 text files and i have to compare the strings in them such that if two files have similar strings then i keep only 1 of it in a buffer and compare it with the next file. if theses two have some strings different then i will unite them.and remember the folder name e.g test 19, test 100 in a separate file.if somebody has an idea abt it please help me.

1. Use snprintf to generate the appropriate path name.

2. Think of an appropriate data structure, that's what this exercise is all about.