2021. 2. 22. 15:56ㆍLinux API
man7.org/linux/man-pages/man2/open.2.html
open(2) - Linux manual page
open(2) — Linux manual page OPEN(2) Linux Programmer's Manual OPEN(2) NAME top open, openat, creat - open and possibly create a file SYNOPSIS top #include #include #include int open(const char *pathname, int flags); int open(const
man7.org
|
1
2
3
4
5
6
7
|
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int open(const char *pathname, int flags);
// 성공 시 파일 디스크립터 리턴, 실패 시 -1 리턴
|
cs |
#include <sys/stat.h>
neosrtos.com/docs/posix_api/sysstat.html
파일 상태 - - NEOS POSIX 함수 설명서
파일 상태 목차 fstat — 파일의 상태 정보를 얻는다. mkdir — 새로운 디렉터리를 생성한다. stat — 파일 정보를 얻는다. 헤데 파일 파일의 상태를 확인하기 위한 자료형, 구조체, 상수와
neosrtos.com
#include <fcntl.h>
neosrtos.com/docs/posix_api/fcntl.html
파일 제어 - - NEOS POSIX 함수 설명서
목차 creat — 파일을 생성한다. fcntl — 파일을 제어한다. open — 파일을 연다. 헤더 파일 함수 fcntl()과 open()을 위한 자료형, 상수, 그리고 함수들을 정의한다. 함수 fcntl()의 cmd를 위해 다음
neosrtos.com
| O_RDONLY | read only |
| O_WRONLY | write only |
| O_RDWR | read + write |
| O_CREAT | If pathname does not exist, create it as a regular file |
※ rwxrwxrwx --> S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH
| O_TRUNC | If the file already exists and is a regular file and the access mode allows writing it will be truncated to length 0. If the file is a FIFO or terminal device file, the O_TRUNC flag is ignored. Otherwise, the effect of O_TRUNC is unspecified. |
'Linux API' 카테고리의 다른 글
| 기초 리눅스 API vol.1 연습문제 풀어보기 (4장) (0) | 2021.02.23 |
|---|