use CFileFind class for example:#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:"));
}i think it can help you !
#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:"));
}i think it can help you !
解决方案 »
- 串口打开时“打开”按钮,怎样将字体“打开”随之改变为“”发送???
- 想做一个进程监控的程序,请给些建议
- 结束Dialog对话框时Debug Assertion Failed
- 求助 个人制作的一个上位机软件 ,和单片机通讯,在笔记本上和台式机上完全没有问题,可是在工控机上就出问题
- 这样的分割窗口的界面,怎么实现?
- 获得的鼠标当前位置怎么不对呢
- 如何添加环境变量
- 我想用VC写一个后台服务程序,隐藏在后台运行,就是只能在Windows2000服务管理器里边看到的那种。用它来收局域网其他程序发来的消息,然
- 哪位大虾给个FFT(快速傅立叶变换)的C源码?
- 如何将当前目录的chm文件调出来?
- 请问,如何把单文档程序静态分割成4个窗口视图
- 极怪的问题,请高手指点!
http://www.vckbase.com/document/listdoc.asp?mclsid=15&sclsid=1501
http://www.tech521.com/techData/data/1410.asp
文件查找其实网上挺多的,有问题只要我会必帮