카테고리 없음
[C++] 특정 폴더내 파일이름 가져오기.
MaxLevel
2021. 11. 3. 22:19
string path = "C:\\Users\\JYP\\Desktop\\p\\resource\\spam\\*.*";
// 맨끝에 *대신 특정 확장자를 입력하면 그 확장자만 읽어올 수 있다.
struct _finddata_t fd;
intptr_t handle;
if ((handle = _findfirst(path.c_str(), &fd)) == -1L)
{
cout << "No file in directory!" << endl;
// 파일이 없을경우 발생시킬 이벤트.
}
do
{
cout << fd.name << endl;
} while (_findnext(handle, &fd) == 0);
_findclose(handle);