遍历文件夹

来源:互联网 发布:java框架电子书 编辑:程序博客网 时间:2024/05/29 09:46
// readXml.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>#include <string>#include <windows.h>using namespace std;int _tmain(int argc, _TCHAR* argv[]){BOOL IsOver = false;HANDLE hfile;//查找文件句柄WIN32_FIND_DATA wfdata;//文件信息结构hfile = FindFirstFile("task/*.xml", &wfdata);if (hfile == INVALID_HANDLE_VALUE)  IsOver = true;while (!IsOver){string  strTmpPath = (wfdata.cFileName);    //此行会报错,将项目属性改为  “使用多字节字符集”cout << strTmpPath << endl;IsOver = !FindNextFile(hfile, &wfdata);}stem("pause");return 0;}