#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 << "
";
return 0;
}
stober 란 애 한테 감사하렴.
백슬래쉬 다 날아갔당~
코드 보니까 머리 아프네요 ... 감사합니다 !!
http://autogram.tk/이
중고차 어플리케이션 어떤가요?