Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4595291
  • 博文数量: 671
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 7310
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-14 09:56
文章分类

全部博文(671)

文章存档

2011年(1)

2010年(2)

2009年(24)

2008年(271)

2007年(319)

2006年(54)

我的朋友

分类: C/C++

2007-05-16 15:26:20

 

#include
#include
#include
using namespace std;
void filesearch(string path,int layer)
{
    struct _finddata_t filefind;
    string curr=path+"\\*.*";
    int done=0,i,handle;
    if((handle=_findfirst(curr.c_str(),&filefind))==-1)return;
    while(!(done=_findnext(handle,&filefind)))
    {
        if(!strcmp(filefind.name,".."))continue;
        for(i=0;i        if ((_A_SUBDIR==filefind.attrib))
        {     
            cout<            curr=path+";
            filesearch(curr,layer+1);
        }
        else
        {
            cout<        }
    }   
    _findclose(handle);     
}
int main()
{   
    string path;
    cout<<"请输入目录"<    cin>>path;
    filesearch(path,0);
    system("PAUSE");
    return 0;
}

阅读(2822) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~