摘要: 定义 参数 注意事项 文件与内存映射 // 修改文件内存映射 #include <stdio.h> #include <sys/mman.h> // mmap #include <sys/stat.h> // open #include <sys/types.h> // open #include 阅读全文
posted @ 2022-04-30 20:22 starc的miao 阅读(75) 评论(0) 推荐(0)
摘要: 定义 函数声明 flock结构体 建议锁 强制锁 实例 #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/file.h> void lock_set(int fd, 阅读全文
posted @ 2022-04-30 20:07 starc的miao 阅读(46) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> int main(void) { struct stat st; if (-1 == stat("./log.txt", &st)) { perror("error:"); ex 阅读全文
posted @ 2022-04-30 14:25 starc的miao 阅读(44) 评论(0) 推荐(0)
摘要: lseek文件偏移量 lseek()不适用于所有类型的文件,不允许应用于lseek()应用于管道、FIFO、socket或者终端 文件空洞 /*拷贝多份文件*/ #include <stdio.h> #include <fcntl.h> // open #include <string.h> #in 阅读全文
posted @ 2022-04-30 13:26 starc的miao 阅读(44) 评论(0) 推荐(0)