给定一个目录,如何得到该目录下的所有文件夹或者文件?
解决方案 »
- ActiveX控件里面的控件句柄全然没法拿到吗?
- 请问如何改善cstring中的insert,delete操作(急,在线等待)
- 怎样判断cmd.exe进程是否运行完?
- 一个棘手的算法问题,请高手们试一试!
- 同步、异步及阻塞、非阻塞
- 请问如何将系统时间与SQL中的datetime字段做比较得出相差多少天,谢谢
- 请教一些关于边缘增强的算法,来者有分啊!
- !!!急!!!########关 于 如 何 拦 截 "复制文本" 消 息 ########
- 进程运行中是否可以修改命令行参数,传递某些信息?
- 关于在线程里创建窗口的问题??
- 怎样在vc单文档界面中实现分栏?
- 请教怎么在程序中显示Bitmap图象呢 ?有原代码在线讨论
///////////////#include <afx.h>
#include <iostream>using namespace std;void Recurse(LPCTSTR pstr)
{
CFileFind finder; // build a string with wildcards
CString strWildcard(pstr);
strWildcard += _T("\\*.*"); // start working for files
BOOL bWorking = finder.FindFile(strWildcard); while (bWorking)
{
bWorking = finder.FindNextFile(); // skip . and .. files; otherwise, we'd
// recur infinitely! if (finder.IsDots())
continue; // if it's a directory, recursively search it if (finder.IsDirectory())
{
CString str = finder.GetFilePath();
cout << (LPCTSTR) str << endl;
Recurse(str);
}
} finder.Close();
}void main()
{
if (!AfxWinInit(GetModuleHandle(NULL), NULL, GetCommandLine(), 0)
cout << "panic!" << endl;
else
Recurse(_T("C:"));
}