如何得到特定文件夹下面的文件信息 请问如何得到某一文件夹下面的所有特定后缀得文件名。谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //*************************************************//得到dir目录下面扩展名为ext的所有文件,由strs返回//其中ext可以支持*?通配符//*************************************************BOOL GetDirectoryFiles(CString dir, CString ext,CStringArray& strs){ CFileFind filefinder; CString name; int n=dir.GetLength(); if(dir[n-1]!='\\') dir+="\\";// dir.Replace("\\","\\\\"); BOOL bExist; if(ext=="")//如果扩展名为空则找所有文件 { bExist = filefinder.FindFile(NULL); } else { ext="*."+ext; bExist = filefinder.FindFile(dir+ext); } while (bExist) { bExist = filefinder.FindNextFile(); if(filefinder.IsDots()||filefinder.IsDirectory()) continue; name=filefinder.GetFileName(); strs.Add(name); } return strs.GetSize()>0;} 如何在MFC的dialog上实现像word那样的,自绘图形时选择状态出现控制块 一直用VC++6.0,想学VS2005或VS2008。请问这两种编译器区别大不? 如何按照45度角度画线? 如何查看别人远程控制我的桌面留下的信息 BMP位图问题 [求助]关于自动显示变量类成员 菜问题!!1 请问那里有讲VB做三层结构的资料的? ListView 的扩展,支持平铺视图 向mshtml.dll高手请教:如何保存修改后的IE文档? 一个小问题,CListBox为什么不出现横向滚动条? 为什么ADO数据源不能初始化 ?
//得到dir目录下面扩展名为ext的所有文件,由strs返回
//其中ext可以支持*?通配符
//*************************************************
BOOL GetDirectoryFiles(CString dir, CString ext,CStringArray& strs)
{
CFileFind filefinder;
CString name;
int n=dir.GetLength();
if(dir[n-1]!='\\')
dir+="\\";
// dir.Replace("\\","\\\\");
BOOL bExist;
if(ext=="")//如果扩展名为空则找所有文件
{
bExist = filefinder.FindFile(NULL);
}
else
{
ext="*."+ext;
bExist = filefinder.FindFile(dir+ext);
}
while (bExist)
{
bExist = filefinder.FindNextFile();
if(filefinder.IsDots()||filefinder.IsDirectory()) continue;
name=filefinder.GetFileName();
strs.Add(name);
}
return strs.GetSize()>0;
}