首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

遍历目录文件的有关问题

2012-01-22 
遍历目录文件的问题?CFileFind的两个成员函数的区别:MSDNIsDirectory():Determinesifthefoundfileisadirec

遍历目录文件的问题?
CFileFind的两个成员函数的区别:

MSDN
IsDirectory():
Determines   if   the   found   file   is   a   directory.  
IsDots()  
Determines   if   the   name   of   the   found   file   has   the   name   ". "   or   ".. ",   indicating   that   is   actually   a   directory.  

都是目录??

if(ff.IsDirectory())   &&   !ff.IsDots())//只使用其中之一可否?
{
//如果是一个子目录,用递归继续往深一层找
SearchFile(ff.GetFilePath(),strFile);
}


bcb  
if(sr.Attr==faDirectory   &&   sr.Name!= ". "   &&   sr.Name!= ".. ")   //不搜索.   和   ..  
.   和..表示什么意思?

[解决办法]
“.”为本目录
“..”为父目录
[解决办法]
if(ff.IsDirectory()) && !ff.IsDots())//只使用其中之一可否?
不可,一个是判断是否为目录,一个是判断是否为“.”和“..”目录

“.”和“..”是每个目录下必有的,默认的隐藏的目录 ". "是本目录, ".. "是父目录

热点排行