#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;
}
소스라인 카운터 만들며 놀고있는게 아닌가 추측 ㅋㄸㅋ
ㅋㄷㅋㄷ 씽. ㅠㅠ
http://dblack.tk
커뮤니티 사이트 입니다 많은 이용 부탁 드립니다.