/* WinDirectoryListing.cpp Windows version of directory traversal */ #include #include #include using namespace std; vector < string > m_vectData; void listDir(const char * sdir, int count){ string str, strDir; struct _finddata_t c_file; long hFile; // Find first file in current directory str = sdir + (string) "\\*"; if( (hFile = _findfirst( str.c_str(), &c_file )) == -1L ){ fprintf(stderr, "Error opening %s!\n", str.c_str()); return; } do{ //skip if find . and .. if ((strcmp(c_file.name, ".") == 0 || strcmp(c_file.name, "..") == 0)) { continue; } str = ""; for (int i=0; i