Multithreading to list files

Write your question here.Am working in a project where i have to list all the files in multiple drives and print the list in a .txt files.I implemented using multithreading.It works properly but i dont know how to get the list from vector (where i pushed the files i encountered in a drive which is local to threads).can u suggest me a way how to get the list from local vector ???

DWORD WINAPI List(LPVOID s)
{

deque<string>directories;

string path,spec;
int Files = 0;
vector<string>files;
WIN32_FIND_DATAA ffd;
char *drive = (char*)s;
cout << drive;
directories.push_front(drive);

while(!directories.empty())
{
path = string(directories.front());
spec = path + "\\" + "*";
directories.pop_front();

HANDLE hfind = FindFirstFileA(spec.c_str(),&ffd);
if(hfind == INVALID_HANDLE_VALUE)
continue;
//cout << path << endl;
do
{
if(strcmp(ffd.cFileName,".") && strcmp(ffd.cFileName,".."))
{
if(ffd.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
{
//EnterCriticalSection(&QueueLock);
directories.push_front(path + "\\" + ffd.cFileName);
//LeaveCriticalSection(&QueueLock);
}
else
{
files.push_back(path + "\\" + ffd.cFileName);
Files++;
}
}
}while(FindNextFileA(hfind,&ffd));
FindClose(hfind);
hfind = INVALID_HANDLE_VALUE;
}
cout<<" No of Files "<<Files <<endl ;

return 0;
}
Topic archived. No new replies allowed.