The Beautiful Future
파일로드 std::string 사용 본문
long LoadFileList( string _strFolderPath, vector<string>& strvExt, vector<string>& vFileList)
{
string strFolderPath = _strFolderPath;
// 폴더 안에 있는 모든 영상을 로드한다.
WIN32_FIND_DATA FindData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char szFindFile[MAX_PATH] = {0,};
char szFileName[MAX_PATH] = {0,};
char szOnlyFileName[MAX_PATH] = {0,};
char szExt[MAX_PATH] = {0,};
strcpy(szFindFile, strFolderPath.data());
strcat( szFindFile, "\\*.*");
hFind = FindFirstFile(szFindFile, &FindData);
if( hFind == INVALID_HANDLE_VALUE ) return 0;
//이전에 있던 리스트를 초기화한다.
vFileList.clear();
long nNumReadImage = 0;
strFolderPath += "\\";
string strFilePath;
// 모든 파일을 찾고 확장자를 검사한다.
do
{
_splitpath_s(FindData.cFileName, NULL, NULL, NULL, NULL, szOnlyFileName, MAX_PATH, szExt, MAX_PATH);
string strExt = szExt;
BOOL bEqualExt = FALSE;
for(long i = 0; i < (long) strvExt.size(); ++i)
{
if(strvExt[i] == strExt)
{
bEqualExt = TRUE;
break;
}
}
if( bEqualExt)
{
strFilePath = strFolderPath;
strFilePath += string(FindData.cFileName);
vFileList.push_back(strFilePath);
nNumReadImage++;
}
}while( FindNextFile( hFind, &FindData) );
FindClose( hFind );
return nNumReadImage;
}
'스킬' 카테고리의 다른 글
install python on windows (0) | 2016.07.26 |
---|---|
windows에서 digits objdetction 삽질 실패 (0) | 2016.07.05 |
[ubuntu] file list (0) | 2016.06.20 |
cuda covari matrix (0) | 2016.05.31 |
cuda svd (0) | 2016.05.31 |