遍历文件夹中的所有图片

遍历文件夹中的所有图片:

必要函数的参考链接:https://www.cnblogs.com/ranjiewen/p/5960976.html

#include
#include  //相关API和结构体在这个库中
using namespace std;

void main()
{
    char *filename = "D:/ID_card/*.jpg";

    struct _finddata_t fileinfo;
    long handle;
    handle = _findfirst(filename, &fileinfo);  //返回文件句柄
if (handle == -1) cout << "fail..." << endl; else cout << fileinfo.name << endl;
while (!_findnext(handle, &fileinfo)) { cout << fileinfo.name << endl; } _findclose(handle); system("pause"); }

你可能感兴趣的:(c++)