Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- 해바
- 1874
- 시프
- process control
- 2941
- 입력 버퍼
- Process Communication
- c++
- Baekjoon
- The Balance of the World
- 10773
- 브런치
- c
- IT
- Parenthesis
- 시스템 프로그래밍
- BAKA
- 균형잡힌 세상
- file IO
- 4949
- 5622
- system programming
- QA
- 바샤
- File 조작
- Zero That Out
- 백준
- 전자책
- For Beginners
- LJESNJAK
Archives
- Today
- Total
해바
Lab #5 본문
link()와 unlink 시스템 호출을 사용하여 파일의 이름을 바꾸는 Linux의 mv 커맨드를 구현할 것
- 자기 홈 디렉토리에 lab5 디렉토리를 만든 후 프로그램 파일(mv.c)을 보관할 것
#include <stdio.h>
#include <fcntl.h>
#include <error.h>
int main(int argc, char* argv[]) {
link(argv[1], argv[2]);
unlink(argv[1]);
close(*argv[1]);
return 0;
}
컴파일 :
%gcc mv.c -o mv.out
실행 :
%./mv.out afile bfile
Comments