A) create a file: Intcreat (constchar * filename, mode_tmode) 1. filename: name of the file to be created 2. # include & lt; sys/types. h & gt; # include & lt; sys/stat. h & gt; # include & lt; fcntl. h & gt; 3. mode: creation mode: only create a can be controlled.) create File: Int creat (const char * filename, mode_t mode)
1. filename: name of the file to be created
2. # include
# Include
# Include
3. mode: creation mode: only the write attribute of the created user can be controlled, and other users cannot write, so generally 755
A) S_IRUSR: readable-> 1
B) S_IWUSR: writable-> 2
C) S_IXUSR: executable-> 4
D) S_IRWXU: read/write execution-> 7
4. return value: 0 is returned for success.-1 is returned for failure.
B) file description:
1. essence: a non-negative integer
C) open the file:
1. Int open (const char * pathname, int flags, [mode])
2. # include
# Include
# Include
3. common opening signs:
A) O_RDONLY: Read-only
B) O_WRONLY: write only
C) O_RDWR: Read/Write
D) O_APPEND: append method
E) O_CREAT: create a file that does not exist. open with three parameters must be used,
F) O_NOBLOCK: open in non-blocking mode
D) close the file: int close (int fd)
E) system call: read int read (int fd, const void * buf, size_t length)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service