Powered By:
Android Advice
 

C++

List Files Folders in a Directory in C++ Windows

Posted by on February 18, 2012 at 11:33 pm

Below is an example of how to loop over all files and folders in a given location and output the names. #include <Windows.h> int main(int argc, char** argv) { HANDLE hFind = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd; hFind = FindFirstFile(TEXT(“C:\\temp\\*”), &ffd); do { Sleep(1000); bool isDirectory = ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; if(isDirectory) { cout