Advanced Programming in the UNIX Environment 책 start!!!
◆ open
#include<fcntl.h>
int open(const char *pathname, int oflag, .... /*mode_t mode*/);
(ret) success : file descriptor
failed : -1
◆ creat
#include<fcntl.h>
int creat(const char *pathname, mode_t mode);
(ret) success : file descriptor (WRONLY)
failed : -1
◆ close
#include<unistd.h>
int close(int filedes);
(ret) success : 0
faile : -1
◆ lseek
#include<unistd.h>
int lseek(int filedes, off_t offset, int whence);
(ret) success : new file offset
failed : -1
◆ read
#include<unistd.h>
ssize_t read(int filedes, void *buf, size_t nbytes);
(ret) success : number of byte read , end of file : 0
failed : -1
◆ write
#include<unistd.h>
ssize_t write(int filedes, const void *buf, size_t nbytes);
(ret) success : number of byte written
failed : -1
◆ pread
#include<unistd.h>
ssize_t pread(int filedes, void *buf, size_t nbytes, off_t offset);
(ret) success : 읽은 바이트 수, 파일 끝이면 0
failed : -1
◆ pwrite
#include<unistd.h>
ssize_t pwrite(int filedes, const void *buf, size_t nbytes, off_t offset);
(ret) success : 기록된 바이트 수
failed : -1
◆ dup
#include<unistd.h>
int dup(int filedes);
(ret) success : 새 파일 디스크립터
failed : -1
◆ dup2
#include<unistd.h>
int dup2(int filedes, int filedes2);
(ret) success : 새 파일 디스크립터
failed : -1
◆ sync
#include<unistd.h>
void sync(void);
◆ fsync
#include<unistd.h>
int fsync(int filedes);
(ret) success : 0
failed : -1
◆ fdatasync
#include<unistd.h>
int fdatasync(int filedes);
(ret) success : 0
failed : -1
◆ fcntl
#include<fcntl.h>
int fcntl(int filedes, int cmd, .../*int arg*/);
(ret) success : 성공 시 cmd에 따라 다름
failed : -1
◆ ioctl
#include<unistd.h>
#include<sys/ioctl.h>
#include<stropts.h>
int ioctl(int filedes, int request, ...);
(ret) success : -1 이외의 값
failed : -1
'Computers > Linux System Programming' 카테고리의 다른 글
ch5. standard I/O library (0) | 2013.04.28 |
---|---|
ch4. file & directory (0) | 2013.04.27 |
setjmp, longjmp (0) | 2013.04.17 |
file open option (0) | 2013.04.08 |
[tip] 권한에 따른 홈디렉토리 경로 (0) | 2013.03.08 |