用VC++遍历某一目录下的所有文件
2010-06-04 20:39:30 来源:WEB开发网核心提示:#include "stdafx.h"#include "afx.h"#include "iostream.h"#include "winbase.h"int main(int argc, char* argv[]){DWORD retur
#include "stdafx.h"
#include "afx.h"
#include "iostream.h"
#include "winbase.h"
int main(int argc, char* argv[])
{
DWORD returnValue;
if( SetCurrentDirectory("D:CodePOS") == TRUE)
{
CFileFind finder;
BOOL bWorking = finder.FindFile("*.*");
while (bWorking)
{
bWorking = finder.FindNextFile();
//cout << (LPCTSTR) finder.GetFilePath();
cout << (LPCTSTR) finder.GetFileName() << endl;
}
}
else
{
returnValue = GetLastError();
};
return 0;
}
[]
更多精彩
赞助商链接