新手,刚学习多线程,想要实现这样一个功能,请问有推荐的书籍或技术博客吗?还有这个功能大概要怎么实现?
可以用io.h这个库
#include
#include
#include
using namespace std;
void dir(string path)
{
long hFile = 0;
struct _finddata_t fileInfo;
string pathName, exdName;
if ((hFile = _findfirst(pathName.assign(path).append("\\*").c_str(), &fileInfo)) == -1) {
return;
}
do {
cout << fileInfo.name << (fileInfo.attrib&_A_SUBDIR? "[folder]":"[file]") << endl;
} while (_findnext(hFile, &fileInfo) == 0);
_findclose(hFile);
return;
}
int main()
{
string path="G:\testdir";
dir(path);
return 0;
}
http://www.cnblogs.com/lixiaohui-ambition/archive/2012/07/26/2610336.html