就是我想把一个目录下所有子目录和文件的信息保存到一个文本文件中。
解决方案 »
- 新开的线程操作主线程里的MFC界面包装类时出现Debug Assertion Failed
- Visual C++游戏设计(第二版)的cd,能否发给我一份 我有书没光盘
- 写了一个DLL,有FRAME,DOC
- ***网络游戏外挂引擎源代码大放送***
- 如何使用ClassWizard删除一个类?
- 有没有那位大侠用人工神经网络作过电力负荷预测,非常希望交流!
- 谁能帮我看看这个问题?给100分
- 请介绍将对话框(自己做的)封装入DLL的具体步骤?谢谢!或文档也行。
- 在vc下如何建立坐标系,请指点:)
- 标题栏图标显示
- 在哪儿可找到COM规范?(急求!有重赏)
- 为什么在我的对话框属性里面没有设置语言这个选项?
sFolderPath :指定的目录
CString FileName[200] ;
HANDLE hFile; CString tempStr;
tempStr=sFolderPath+"\\*.mdb"; WIN32_FIND_DATA FindFileData;
hFile=::FindFirstFile(tempStr,&FindFileData); BOOL blnExact=true;
if (hFile==INVALID_HANDLE_VALUE)
{
AfxMessageBox("Don't find the mdb file!");
return;
} int i=0;
FileCount=0;
while(blnExact)
{
FileName[i]=FindFileData.cFileName;
FileCount++;
i++;
blnExact=::FindNextFile( hFile,&FindFileData);
} ::FindClose(hFile);
{ 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;
}