C++ファイルパスでの画像読み込み


ファイルのパスを指定して、パスの下の画像をVectorに読み込みます.
#include 

void getFiles(string path, vector& files)
{
	//    
	long long hFile = 0;
	//    
	struct _finddata_t fileinfo;
	string p;
	if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1) 
	{
		do {
			//     ,   
			//    ,    
			if ((fileinfo.attrib & _A_SUBDIR)) 
			{
				if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) 
				{
					getFiles(p.assign(path).append("\\").append(fileinfo.name), files);
				}
			}
			else 
			{
				files.push_back(p.assign(path).append("\\").append(fileinfo.name));
				//files.push_back(fileinfo.name);
			}
		} while (_findnext(hFile, &fileinfo) == 0); _findclose(hFile);
	}
}

特に注意:long long hFile=0の定義は、Win 10システムでlong hFile=0を使用するとエラーが発生します.