首页
诗词
字典
板报
句子
名言
友答
励志
学校
网站地图
windows
windows
windowsxp
windows server
DOS
UNIXLINUX
windows7
当前位置:
首页
>
教程频道
>
操作系统
>
windows
>
Windows上遍历文件目录
2012-07-08
Windows下遍历文件目录最近用到遍历文件目录,总结一下:void BuildRegSystem(const tstring& strFileSystem
Windows下遍历文件目录
最近用到遍历文件目录,总结一下:
void BuildRegSystem( const tstring& strFileSystemPath, const tstring& strAddParPath, CSysMgr& mgr ){ tstring strFsPath = strFileSystemPath; tstring strEnumPath = strFileSystemPath; tstring strAddNewPath = strAddParPath; if (*strFsPath.rbegin() != _T('\\')) { strFsPath += _T('\\'); } if (*strAddNewPath.rbegin() != _T('\\')) { strAddNewPath += _T('\\'); } strEnumPath = strFsPath + _T("*.*"); WIN32_FIND_DATA fndFile; HANDLE hFnd = ::FindFirstFile(strEnumPath.c_str(), &fndFile); if (hFnd == INVALID_HANDLE_VALUE) { return ; } while (::FindNextFile(hFnd, &fndFile)) { tstring strFileName = fndFile.cFileName; if (strFileName == _T("..")) {// 如果是上级目录,则不管. continue; } if (fndFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { // 如果是文件夹,则进行递归. mgr.CreateRegDirectory(strAddNewPath + strFileName); BuildRegSystem( strFsPath + strFileName, strAddNewPath + strFileName, regSystem ); } else { mgr.InsertEntry(strAddParPath, strFileName); } } ::FindClose(hFnd);}void Test(){ CSysMgr mgr; BuildRegSystem(_T("D:\\Program Files\\11game"), _T("\\"), mgr); // ... // ...}
没有任何复杂的操作,只为备忘。
查看更多
下一篇
本文网址:
https://www.reader8.net/jiaocheng/20120708/2147736.html
读书人精选
热点排行
求大神解答windows服务器上IBM的中间件w
仅透过WIFI让笔记本与台式机均上网
不能安装Mysql connector /odbc 64 bit
xp系统安装了两个电脑管理员现在没法切换
Windows server 2008 R2 企业版 装完占了
Could not open virtual machine: E:\Li
win8.1下mentuhust无法使用的有关问题
毕业论文解决思路
使用windows server 2012 设置VPN接入
Server2012 激活工具一枚,测试可用解决