map1 m1;
list1 l1;
while ((dir = readdir(some_path)) != NULL) {
snprintf(buf, sizeof(buf) -1, "%s/%s",some_path, dir->d_name);
/* .......
some code
........
*/
file = fopen(buf, "r");
if (file != NULL) {
while (fgets(buf, sizeof(buf), file) != NULL) {
// Here need to store in map
m1[buf]=list1(dir->d_name); //Here storing into map ,
// folder in which specified path need to store in list
// and data in file will store in map .
}
}
It was a bit confused that time, here is the explanation,
I have some directories and i want to maintain the database using map.
Here, i m trying to read the strings in a file and the file was existed in directory.
Ex: f1 is a name of file existed in d1 ( directory )
f1 contains strings which are specified in each line
abcdf
afafete
coder777
dhayden
...
...
and so on
the same file f1 is located in every directory like d2, d3 ..and so on
i want to maintain the database like strings are my key value and directories are my mapped value .
purpose : I want to know what are the similar strings which are existed in files under different directories in a one shot display.
no problem with display the prob is storing into map ..line 17 in above code.