기본적인 파일 관리함수

 

int _access( const char *path, int mode );

 

파일을 엑세스 하기 전에 파일이 실제로 존재하는지 확인하는 함수입니다.

 

path : 조사할 파일의 경로

 

mode: 조사할 상태 지정 ( 0 은 존재, 2 는 쓰기, 4 는 읽기 )

 

return : 요청한 허가 상태를 가지면 0을 리턴, 그렇지 않으면 -1을 리턴

 

 

 

int remove( const char *path );

int _unlink( const char *filename );

 

위의 두 함수는 파일을 삭제 합니다.

 

path : 삭제하고자 하는 파일의 경로만 지정

 

 

 

int rename( const char *oldname, const char *newname );

 

이 함수는 파일의 이름을 변경합니다.

 

oldname : 변경하고자 하는 파일의 이름

 

newname : 새로 설정할 파일의 이름

 

 

 

int _chmod( const char *filename, int pmode );

 

파일의 속성을 변경 합니다.

 

pmode : _S_IWRITE  ,  _S_IREAD  둘중 하나를 주거나 둘다 줄수도 있음

 

 

파일검색 함수

 

long _findfirst( char *filespec, struct _finddata_t *fileinfo );

 

위의 함수로 첫번째 파일 검색 합니다.

 

int _findnext( long handle, struct _finddata_t *fileinfo );

 

위의 함수로 조건이 일치하는 다음 파일을 찾을수 있습니다.

 

int _findclose( long handle );

 

위의 함수로 모든 검색이 완료된 후 검색 핸들을 닫아 줍니다.

 

 

 

디렉토리 관리 함수

 

int _chdir( const char *dirname );

 

현제 작업중인 디렉토리의 경로 변경

 

char *_getcwd( char *buffer, int maxlen );

 

현재 작업 디렉토리를 조사

 

int _mkdir( const char *dirname );

 

디렉토리 생성

 

int _rmdir( const char *dirname );

 

디렉토리 제거

 

void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext );

 

경로 관리 함수로서  4개의 구분자로 분리한다.

 

void _makepath( char *path, const char *drive, const char *dir, const char *fname

                              , const char *ext );

 

경로 관리 함수로서 분리되어 있는 구분자를 합친다.

 

 

 

 

디스크 관리 함수

 

int _getdrive( void );

 

int _chdrive( int drive );

 

위의 두 함수는 작업 드라이브를 조사하거나 변경한다.


출처 : http://kin.naver.com/detail/detail.php?d1id=1&dir_id=10104&eid=4nUPmPpSlArMwqppck/df6nNQlKLaqFi&qb=tfC3usXkuK4gu+jBpiDH1Lz2&pid=fg9d8doi5ThssvOkpoZsss--248289&sid=ST9Q0woyP0kAAEgIOOk

+ Recent posts