#include <windows.h> #include <string> #include <vector> #include <iostream> #include <iterator> using namespace std; void GetFiles(vector<string>& aDest, const string& aWhatAndWhere) { WIN32_FIND_DATA FindData; HANDLE FindHandle = FindFirstFile(aWhatAndWhere.c_str(), &FindData); if(FindHandle == INVALID_HANDLE_VALUE) { cout << "No files" << endl; return; } do { if(!(FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) aDest.push_back(FindData.cFileName); } while(FindNextFile(FindHandle, &FindData)); FindClose(FindHandle); } int main() { vector<string > FileList; GetFiles(FileList, "C:\\\\windows\\\\*"); copy(FileList.begin(), FileList.end(), ostream_iterator<string>(cout, "\\n")); }