메뉴 건너뛰기

app

[C++] 하위 폴더 검색 최간편 소스

박영식2011.05.04 22:50조회 수 13602댓글 1

    • 글자 크기
하위 폴더 검색 최간편 소스

#include "stdafx.h"
#include "windows.h"
#include "winbase.h"
#include "stdio.h"
#include "cstringt.h"
#include "atlstr.h"

bool FindnFile( const char *strPath ) 
{
bool bContinue = true;
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
char strFindPath[ 1024 ], strFileName[ 1024 ];
sprintf( strFindPath, "%s*.*", strPath );
hFind = FindFirstFile( strFindPath, &FindFileData );
if( hFind == INVALID_HANDLE_VALUE ) return false;

while( bContinue )
{ 
strcpy( strFileName, FindFileData.cFileName );
if( ( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) == FILE_ATTRIBUTE_DIRECTORY )
{
if( strcmp( strFileName, "." ) !=0 && strcmp( strFileName, ".." ) != 0 )
{ 
sprintf( strFindPath, "%s%s", strPath, strFileName );
FindnFile( strFindPath );
}
}
else {

CString FullPathName;
FullPathName.Format("%s%s", strPath, strFileName );
printf("%s",FullPathName);
}

if( FindNextFile( hFind,&FindFileData ) == FALSE )
bContinue=false;
}
FindClose( hFind );
return true;
}
박영식 (비회원)
    • 글자 크기
[C++] 정규식을 사용하기 위한 clr (by 박영식) [AI] Google AI challenge starter_package 실행 해 보기 (by 박영식)

댓글 달기

댓글 1
suritam9
2013.06.28 조회 2711
suritam9
2013.04.25 조회 6561
suritam9
2013.04.04 조회 2499
suritam9
2012.09.14 조회 2746
suritam9
2012.06.24 조회 2673
suritam9
2012.06.24 조회 3056
suritam9
2012.06.24 조회 2853
suritam9
2012.06.22 조회 2852
박영식
2011.09.22 조회 2894
박영식
2011.09.21 조회 2832
박영식
2011.02.18 조회 3309
첨부 (0)
위로