I tried listing files using the code given in "http://forum.codecall.net/topic/57996-list-files-in-a-directory-for-c/" the program listed all the files present in the current dirctory but if i change the drive and the directory to such as "C:\Users\Baaoo\Downloads\direct.h function"
the program does not list files name, any suggestion.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include <dirent.h>
usingnamespace std;
int main() {
DIR* dir;
dirent* pdir;
dir = opendir("."); // open current directory
while (pdir = readdir(dir)) {
cout << pdir->d_name << endl;
}
closedir(dir);
return 0;
}