如何读取文件夹? 怎样计算一个文件夹中的文件个数?并且如何逐一取出其文件名? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 下面的代码你也许用的着BOOL GetFolderAndFile(CString szFolder){ CFileFind finder; CString szSearch=""; szSearch.Format("%s\\*.*", szFolder); BOOL bFind=finder.FindFile(szSearch); if(!bFind)return FALSE; CString szPath=""; while(bFind){ bFind=finder.FindNextFile(); if(finder.IsDots())continue; szPath=finder.GetFilePath(); if(finder.IsDirectory()){ cout<<"find a Folder:"<<szPath<<endl; GetFolderAndFile(szPath); continue; } else { cout<<"Find a File:"<<szPath<<end; //取文件属性 ... } nSize+=finder.GetLength(); } finder.Close(); return TRUE;} 立即释放dll的问题 请问如何区分上下两条近似直线的点? VC/MFC 基础类斑竹申请贴,各位给点人气============= 重载了OnClose() ,编译有88个错误.. 一个既能聊天又能传输文件的程序,出现“内存不足”???? 在.h文件中定义, 在.cpp文件中实现, 可以吗? com技术应用多吗?用在哪些方面? 如何将一个窗口中的所有内容(包括控件,图像等)当作一幅位图拷贝下来? 怎么播放AVI文件?? 关于CScrollView的问题 关于CreateWindow的问题? 小龙女小品文系列之-----区分继承类型 (下)
BOOL GetFolderAndFile(CString szFolder)
{ CFileFind finder;
CString szSearch="";
szSearch.Format("%s\\*.*", szFolder);
BOOL bFind=finder.FindFile(szSearch);
if(!bFind)return FALSE;
CString szPath="";
while(bFind){
bFind=finder.FindNextFile();
if(finder.IsDots())continue;
szPath=finder.GetFilePath();
if(finder.IsDirectory()){
cout<<"find a Folder:"<<szPath<<endl;
GetFolderAndFile(szPath);
continue;
}
else
{
cout<<"Find a File:"<<szPath<<end;
//取文件属性
...
}
nSize+=finder.GetLength();
} finder.Close();
return TRUE;
}