社区
C语言
帖子详情
谁有查找目录及子目录中所有文件的函数,将找到的文件放到TStrings。
ljhsoft
2002-04-05 10:12:23
我以前写了一个,使用替归的方法实现的,后来丢了手提电脑连函数也丢了。
TString * __fastcall GetFileFromDir(AnsiString strPathName)
{
//添加代码
}
...全文
66
1
打赏
收藏
谁有查找目录及子目录中所有文件的函数,将找到的文件放到TStrings。
我以前写了一个,使用替归的方法实现的,后来丢了手提电脑连函数也丢了。 TString * __fastcall GetFileFromDir(AnsiString strPathName) { //添加代码 }
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
ccnuxjg
2002-04-05
打赏
举报
回复
我上个月刚写的,送给你
void CNormalSearchDlg::OnOk()
{
// TODO: Add your control notification handler code here
int filenum = 0;
CString *filepath = 0;
filepath = new CString[1000];
FindTheExtFile( "D:\\temp", ".chm", filenum, filepath );
if( filepath!=NULL )
{
delete[]filepath;
filepath = NULL ;
}
}
//------------------------------------------------------------------------------------------------
// 函数名:FindTheExtFile
//
// function: search all the file in the Path that it's external name is Exname
// return: 所有的找到文件的完整路径--一个指针
// how to use: FindTheExtFile( "D:\\temp", ".chm", filenum, filepath );
// 作者: xiangjiangang
// Finish Date: 10:07 2002-3-29
//------------------------------------------------------------------------------------------------
BOOL CNormalSearchDlg::FindTheExtFile(const CString Path, const CString ExName, int &count, CString* OutPath)
{
CString tempPath[1000];
FindAllFile( Path, count, tempPath );
//在此过滤非扩展路径名的文件
int j = 0;
for( int i = 0; i < count; i ++ )
{
if( tempPath[i].Right( 4 ) == ExName )
{
OutPath[j] = tempPath[i];
j++;
}
}
count = j;
return TRUE;
}
//----------------------------------------------------------------------------------------
// 函数名:FindAllFile
//
// function: search all the file in the Path
// return: 所有的找到文件的完整路径--一个指针
// how to use: FindAllFile( Path, count, tempPath );
// 作者: xiangjiangang
// Finish Date: 10:07 2002-3-29
//----------------------------------------------------------------------------------------
BOOL CNormalSearchDlg::FindAllFile(const CString Path, int &count, CString *OutPath)
{
CFileFind tempFind;
char tempFileFind[200];
sprintf( tempFileFind, "%s\\*.*", Path );//先查找所有文件,这样不会遗漏子目录下面的文件
BOOL IsFinded=(BOOL)tempFind.FindFile(tempFileFind);
while(IsFinded)
{
IsFinded=(BOOL)tempFind.FindNextFile();
if(!tempFind.IsDots())//if the found file has the name "." or "..",是一真实路径
{
char foundFileName[200];
strcpy(foundFileName,tempFind.GetFileName().GetBuffer(200));//得到找到的文件的文件名或子路径
if(tempFind.IsDirectory())//如果是下层目录
{
char tempDir[200];
sprintf(tempDir,"%s\\%s",Path,foundFileName);
FindAllFile( tempDir, count, OutPath );//递归调用函数进行深度搜索
}
else
{
char tempFileName[200];
sprintf(tempFileName,"%s\\%s",Path,foundFileName);
OutPath[count] = tempFileName;//得到输出文件完整路径
count++;
}
}
}
tempFind.Close();
return TRUE;
}
delphi 开发经验技巧宝典源码
0142 使用FileWrite
函数
将缓冲区
中
的内容写入
文件
91 4.10 其他
函数
91 0143 使用Random
函数
产生7个随机数 91 0144 使用DiskFree
函数
返回磁盘驱动器的剩余空间 91 0145 如何使用Printer
函数
92 0146 使用...
delphi 开发经验技巧宝典源码06
0142 使用FileWrite
函数
将缓冲区
中
的内容写入
文件
91 4.10 其他
函数
91 0143 使用Random
函数
产生7个随机数 91 0144 使用DiskFree
函数
返回磁盘驱动器的剩余空间 91 0145 如何使用Printer
函数
92 0146 使用...
6.Delphi
文件
管理
Delphi继承了Object Pascal的
文件
管理功能,并有很大的发展,其
中
最主要的是提供了用于
文件
管理的标准控件,同时也提供了更多的
文件
管理
函数
。利用Delphi的强大功能,开发一个自己的
文件
管理系统就成为很容...
Delphi INI
文件
读取(1)
INI
文件
在系统配置及应用程序参数保存与设置方面,具有很重要的作用,所以可视化的编程一族,如VB、VC、VFP、Delphi等都提供了读写INI
文件
的方法, 其
中
Delphi
中
操作INI
文件
,最为简洁,这是因为Delphi提供了一个...
delphi读取ini
文件
delphi读取ini
文件
2007-05-04 09:25:40| 分类: 程序编写 | 标签: |字号大
中
小 订阅 . delphi读取ini
文件
INI
文件
在系统配置及应用程序参数保存与...
中
Delphi
中
操作INI
文件
,最为简洁,这是因为Delphi提供了一个
C语言
70,020
社区成员
243,263
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章