File Access Primitives
//fd 반환. O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_CREAT, O_EXCL, O_TRUNC, O_NONBLOCK
int open(const char *pathname, int flags, [mode_t mode]);
int creat(const char *pathname, mode_t mode); //open 옵션으로 O_WRONLY | O_CREAT | O_TRUNC 넣은 것과 동일
int clost(int filedes);
ssize_t read(int filedes, void *buffer, size_t n);
//start_flag부터 offset만큼 떨어진 곳 위치 반환. 파일 끝 위치를 확인함으로써 파일 크기 확인 가능
off_t lseek(int filedes, off_t offset, int start_flag);
int dup(int filedes); //fd 복사
int dup2(int filedes, int filedes2); //destination fd를 지정해 줌
//파일의 특성을 control. cmd: F_DUPFD, F_[GET/SET]FD, F_[GET/SET]FL, F_[GET/SET]OWN, F_[GET/SET]LK
int fcntl(int filedes, int cmd, ...);
Standard Input/Output/Error
prog_name < inflie #input으로 infile을 받도록 redirection
prog_name > outfile #output을 oufile으로 보내도록 redirection
prog_1 | prog_2
Standard I/O
//type: r, w, a ,r+ ,w+, a+
File *fopen(const char *restrict pathname, const char *restrict type);
int getc(FILE *istream);
int putc(int c, FILE *ostream);
int fprintf(FILE *restrict fp, const char *restrict format, ...);
void perror(const char *error_message); //에러의 원인과 함께 메세지 출