//************************************** //INCLUDE files for :Easy directory listing //************************************** #include <iostream.h> #include <windows.h> //************************************** // Name: Easy directory listing // Description:This is an EASY example of listing files in a directory. I got this example from another post, but i could not get that post to work, so i modified it and made it easy to use. I'm using this in a new program i am working on. // By: Dustin R Davis (from psc cd) // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //************************************** #include <iostream.h> #include <windows.h> int GetDir(char* dPath) { WIN32_FIND_DATA FileData; HANDLE hFile; hFile = FindFirstFile(dPath,&FileData); if ( INVALID_HANDLE_VALUE == hFile ) { cout << "No files" << endl; return false; } for ( ;; ) { cout << FileData.cFileName << endl; if ( 0 == FindNextFile(hFile, &FileData ) ) break; } return true; } int main() { GetDir("c:\\*.txt"); return true; }