C함수 파일 또는 디렉토리 삭제 remove()
파일 또는 디렉토리를 삭제합니다.
- 헤더: stdio.h
- 형태: int remove(const char *pathname)
- 인수: char *pathname 삭제할 파일이나 디렉토리
- 반환: int 0 == 성공, -1 == 실패
C언어 remove() 함수 예제
#include <stdio.h>
int main()
{
if ( -1 == remove( "a.out"))
printf( "파일 삭제 실패n");
}
C언어 remove() 예제 실행 결과
]$ ./a.out
]$ ls
test.c <- 컴파일해서 만들어진 실행파일 a.out이 없습니다.
]$
'컴퓨터 > 프로그래밍' 카테고리의 다른 글
C언어 파일 또는 디렉토리 이름을 변경 함수 rename() (0) | 2020.03.15 |
---|---|
C언어 심볼릭 링크를 생성 함수 symlink() (0) | 2020.03.15 |
C언어 링크 삭제 함수 unlink() (0) | 2020.03.15 |