C++获取某个目录下的所有图片

C++获取某个目录下的所有图片

vector<string> getImages(string path)
{
    vector<string> imagesList;
    intptr_t hFile = 0;
    struct _finddata_t fileinfo;
    string p;

    hFile = _findfirst(p.assign(path).append("\\*.jpg").c_str(), &fileinfo);

    if (hFile != -1) {
        do {
            //cout << fileinfo.name << endl;
            imagesList.push_back(fileinfo.name);//保存类名
        } while (_findnext(hFile, &fileinfo) == 0);
    }
    return imagesList;
}

 

 

 

##############################

posted @ 2021-12-19 20:25  西北逍遥  阅读(483)  评论(0编辑  收藏  举报