| | |
Please Help : Urgent
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2009
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
help me in listing file names inside directory by using a simple code in c++ that a beginner can understand
WIN32_FIND_DATA fileData;
HANDLE hFind = FindFirstFile("C:\WINDOWS\*.exe", &fileData);
this will get the first .exe file that it can find in C:\WINDOWS, and fill the file's information into fileData
FindNextFile(hFind, &fileData)
calling this function will then get the next file matching that pattern. FindNextFile(...) will return NULL when it cant find anymore files.
note that subdirectories are sorta considered files, so will also be returned if they match the pattern (eg you use "C:\WINDOWS\*"), so you can check what is a directory (ie not a file) with:
fileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY
so, using these functions in a simple do-while loop will cycle through every file or subdirectory in a particular folder
![]() |
Similar Threads
- pls heeeeeeeeelp its urgent. (C)
- Urgent! (C++)
- URGENT: Need help on I/O code! (Java)
- Urgent help (Networking Hardware Configuration)
- Homepage keeps switching back to a porn site (Web Browsers)
- Importing SQL Script File - Urgent !! (Database Design)
Other Threads in the C++ Forum
- Previous Thread: factorial problem
- Next Thread: i want function to know the active language in windows
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





