Below is a short code I've extracted from the FAQ on "Viewing files in a directory".
But I have a small problem with the file type. I'm only looking for mp3 files, but if do *.mp3 it can't locate sub directories... How would you suggest for me to do this, I thought about strstr() but it seems like a really lame idea.
Thanks in advance.
using namespace std;
void doit(char *root)
if ((h=FindFirstFile("*.mp3", &info)) != INVALID_HANDLE_VALUE)
if (!(strcmp(info.cFileName, ".") == 0 || strcmp(info.cFileName, "..") == 0))
if (info.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
sprintf(newroot, "%s\\%s", root, info.cFileName);
cout << info.cFileName << "\n";
} while (FindNextFile(h, &info));