I tried to read all file names of a directory into array and my code successfully addes whole file names into array. However, what i need it to do,
1st one is getting ,not all of them, only spesific file names which end like .cpp or .java. It should be done in this part and my comparisons did not work. How can i do that ?
DIR *dir;
struct dirent *dirEntry;
vector<string> dirlist;
while ((dirEntry = readdir(dir)) != NULL)
{
//here
dirlist.push_back(dirEntry->d_name);
}
2dn one is getting the directory location from user. I couldn't do that also, it only works if i write the location adress, how can i get location from user to get files ?
dir = opendir(//here);