#pragma warning(disable: 4786)

#include <windows.h>

#include <iostream>

#include <vector>

#include <string>

using namespace std;



void DirectorySearch(vector<string>& list, const string& path)

{

WIN32_FIND_DATA data;

string fname = path + "\\\\*.*";

string name;

HANDLE hFile = FindFirstFile(fname.c_str(),&data);

if(hFile != INVALID_HANDLE_VALUE)

{

do {

fname = path + "\\\\" + data.cFileName;

if(!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))

{

list.push_back(fname);

}

else

{

// this is a directory

name = data.cFileName;

if(name != "." && name != "..")

{

DirectorySearch(list,fname);

}

}

} while( FindNextFile(hFile,&data) );

FindClose(hFile);


}


}


int main()

{

vector<string> theList;

DirectorySearch(theList,"c:\\\\windows");

vector<string>::iterator it;

for(it = theList.begin(); it != theList.end(); it++)

cout << *it << "\n";

return 0;


}