📄 test1.c
字号:
#include <stdio.h>#include <unistd.h>#include <fcntl.h>void main(){ int fd, r; char buf[32]; fd = open("data", O_CREAT | O_IMMED | O_RDWR); if(fd < 0) { printf("Fail to file open\n"); return; } r = write(fd, "This is an immediate file", 8); r = write(fd, "0123456789ABCDEF\0", 16); printf("File write: %d\n", r); close(fd); fd = open("data", O_RDWR); if(fd < 0) { printf("Fail to file open\n"); return; } r = read(fd, buf, 32); buf[31] = '\0'; printf("File read %d bytes: %s\n", r, buf);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -