遍历文件夹中的所有图片

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

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

#include<iostream>
#include<io.h>  //相关API和结构体在这个库中
using namespace std;

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

    struct _finddata_t fileinfo;
    long handle;
    handle = _findfirst(filename, &fileinfo);  //返回文件句柄<br>
    if (handle == -1) cout << "fail..." << endl;
    else
        cout << fileinfo.name << endl;<br>
    while (!_findnext(handle, &fileinfo))
    {
        cout << fileinfo.name << endl;
    }
    _findclose(handle);
    system("pause");
}
发布了18 篇原创文章 · 获赞 31 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/alvinlyb/article/details/78892216