Game Dev/Article

File 존재 여부 검사

AKer 2008. 6. 3. 16:38
반응형
BOOL IsFileExist1( LPSTR lpszFilename ) 
{ 
    HANDLE hFile = CreateFile( lpszFilename, 0, 
           FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL ); 
    if ( hFile != INVALID_HANDLE_VALUE ) 
    { 
        CloseHandle(hFile); 
        return TRUE; 
    } 

    return FALSE; 
}    
BOOL IsFileExist2( LPSTR lpszFilename ) 
{ 
    WIN32_FIND_DATA wfd; 
  
    HANDLE hFind = FindFirstFile( lpszFilename, &wfd ); 
  
    if ( hFind == INVALID_HANDLE_VALUE ) 
        return FALSE; 

    FindClose(hFind); 
    return TRUE; 
} 
BOOL IsFileExist3( LPSTR lpszFilename ) 
{ 
    DWORD dwAttr = GetFileAttributes( lpszFilename ); 
  
  if( dwAttr = 0xffffffff ) 
        return FALSE; 
    else 
        return TRUE; 
} 


반응형

'Game Dev > Article' 카테고리의 다른 글

Send Stream to Notepad  (0) 2008.06.09
Accurately Profiling Direct3D API Calls (Direct3D 9)  (0) 2008.06.09
FreeType에서 FT_PIXEL_MODE_MONO 처리  (0) 2008.06.04
Process 중복 실행 방지  (0) 2008.06.03