티스토리 뷰

개발

파일 존재여부 확인

likehood~ 2008. 9. 11. 16:16
_access()함수를 이용하면 쉽게 파일 존재여부를 확인할 수 있습니다.









// compile with: /W1 // This example uses _access to check the file named // crt_ACCESS.C to see if it exists and if writing is allowed. #include <io.h> #include <stdio.h> #include <stdlib.h> int main( void ) { // Check for existence. if( (_access( "crt_ACCESS.C", 0 )) != -1 ) { printf_s( "File crt_ACCESS.C exists.\n" ); // Check for write permission. // Assume file is read-only. if( (_access( "crt_ACCESS.C", 2 )) == -1 ) printf_s( "File crt_ACCESS.C does not have write permission.\n" ); } }


'개발' 카테고리의 다른 글

simpleAdo 20081112b  (0) 2008.11.12
MS-SQL에서 ALTER TABLE로 컬럼생성시 위치지정하기  (0) 2008.11.12
Doxygen 및 HTML Help workshop 설치  (0) 2008.06.13
RTLS  (0) 2008.05.21
문서화 툴 리스트  (0) 2008.05.06
댓글