반응형
#include <windows.h>
#include <iostream>
#include <cstdio>
#include <tchar.h>
#define UNICODE
void WCharToChar(const wchar_t* pwstrSrc, char pstrDest[])
{
int nLen = (int)wcslen(pwstrSrc);
wcstombs(pstrDest, pwstrSrc, nLen + 1);
}
int main(){
_wsetlocale(LC_ALL, _T("korean"));
WIN32_FIND_DATA findFileData;
HANDLE hFileHandle;
// szDir에 뒤지고자 하는 디렉토리의 경로명을 준다. 예를 들면 "C:\\TEMP\\*.*"
// 찾아진 파일의 속성은 findFileData의 dwFileAttributes를 살펴본다.
hFileHandle = FindFirstFile(L"S:\졸업프로젝트\Log\_SensorData\*", &findFileData);
if (hFileHandle != INVALID_HANDLE_VALUE) // 파일을 찾은 경우
{
// 찾은 파일의 이름은 cFileName 필드로 들어온다.
// 다음 파일을 찾는다.
while (FindNextFile(hFileHandle, &findFileData)){
char fName[2048];
WCharToChar(findFileData.cFileName, fName);
_tprintf(_T("%s\n"), findFileData.cFileName);
}
FindClose(hFileHandle);
}
}
반응형
'Programming > C & C++' 카테고리의 다른 글
[C++] different underlying type in enum 'enum class TypeName' (0) | 2019.06.14 |
---|---|
[C++] Inheritance: 'A' is an inaccessible base of 'B' (0) | 2019.06.12 |
C에서 날짜 출력하기 (0) | 2015.01.21 |
Const char* vs char* const (0) | 2014.12.24 |
C++ SDL 콘솔창 숨기는법 (0) | 2012.08.23 |
C++ STL vector sort 정렬함수 (0) | 2012.08.18 |
C++ sstream( sscanf, 문자열스트림 ) (0) | 2012.08.18 |
__imp__WSACleanup@0 외부 기호(참조 위치: _main 함수)에서 확인하지 못했습니다 (0) | 2012.08.17 |
최근댓글