char newpath[200];
strcpy(newpath, path);
strcat(newpath, "\\*"); // 在目录后面加上"\\*.*"进行第一次搜索
int handle;
_finddata_t findData;
handle = _findfirst(newpath, &findData);
if (handle == -1) // 检查是否成功
return;
while (_findnext(handle, &findData) == 0)
{
if (findData.attrib & _A_SUBDIR)
{
if (strcmp(findData.name, ".") == 0 || strcmp(findData.name, "..") == 0)
continue;
string pathName = newpath;
pathName += "\\";
pathName += findData.name;
string partName = findData.name;
cout << partName << endl;
}
}
_findclose(handle);