C++遍历文件夹
来源:互联网 发布:网络促销活动目标 编辑:程序博客网 时间:2024/06/11 01:03
C++遍历文件夹的代码如下:
#include<iostream> #include<string> #include<io.h> using namespace std; void visit(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))) { printf("%s\n",filefind.name); if(!strcmp(filefind.name,"..")){ continue; } for(i=0;i<layer;i++)cout<<" "; if((_A_SUBDIR==filefind.attrib)) //是目录 { printf("----------%s\n",filefind.name); cout<<filefind.name<<"(dir)"<<endl; curr=path+"\\"+filefind.name; } else//不是目录,是文件 { cout<<path+"\\"+filefind.name<<endl; } } _findclose(handle); } int main() { string path; cout<<"请输入目录"<<endl; cin>>path; visit(path,1); system("PAUSE"); return 0; }
- c遍历文件夹
- C/C++遍历文件夹
- c 遍历文件夹
- C/C++ 遍历文件夹
- C#--遍历文件夹实例
- C/C++遍历文件夹
- c/c++遍历文件夹
- C、 C++遍历文件夹,删除文件夹
- linux下C遍历文件夹
- C语言实现遍历文件夹
- C遍历文件夹下文件
- 如何c语言遍历文件夹
- Linux C 文件夹遍历接口.
- Linux C语言遍历文件夹
- C、C++文件夹文件遍历
- 文件夹遍历代码C++(win32平台)
- C/C++遍历文件夹(转)
- C Windows 读取文件夹 遍历文件
- <备忘>关于结构体
- Linux下的svn常用命令
- FCKeditor 详细配置
- SQL点滴26—常见T-SQL面试解析
- js history.go 使用浏览器缓存
- C++遍历文件夹
- C++基础知识sizeof用法 .
- Windows XP远程桌面连接
- 深入解析windows内部原理之一
- Java Runtime 对象
- ubuntu 命令行错误命令提示:慢!!!
- C++之static用法 .
- 【人工智能】软件使用--Weka怎么设定类别
- C++学习--指针