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
- For Beginners
- 균형잡힌 세상
- 바샤
- Zero That Out
- 5622
- 2941
- BAKA
- IT
- process control
- 1874
- 10773
- Parenthesis
- 백준
- LJESNJAK
- Process Communication
- 브런치
- 입력 버퍼
- file IO
- 4949
- QA
- The Balance of the World
- 해바
- 전자책
- 시프
- 시스템 프로그래밍
- File 조작
- c
- c++
- Baekjoon
- system programming
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