VS-VS批量讀取文件夾下的所有文件

1.Release   X64

代碼如下:

#include <stdio.h>
#include <io.h>
#include <string>
int main()
{
	//目標文件夾路徑
	std::string inPath = "F:\\1.VS_Projects\\3.Stitch_MFC\\MFCApplication1\\MFCApplication1\\stitch\\capture\\*.mp4";//遍歷文件夾下的所有文件
									//用於查找的句柄
    //long hFile;
	_int64 handle;
	struct _finddata_t fileinfo;
	//第一次查找
	handle = _findfirst(inPath.c_str(), &fileinfo);
	if (handle == -1)
		return -1;
	do
	{
		//找到的文件的文件名
		printf("%s\n", fileinfo.name);
	} while (!_findnext(handle, &fileinfo));
	_findclose(handle);
	system("pause");
	return 0;
}

效果:

感謝博主:https://blog.csdn.net/weixin_42142612/article/details/82285398

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章