06 2022 档案

摘要:每一次系统调用的 read 和 write 成功返回后,文件的偏移量都会被更新。 因此,如果程序对同一个文件描述符进行读写操作的话,肯定会得到非期望的结果,示例代码如下: #include <stdio.h> #include <stdlib.h> #include <string.h> int m 阅读全文
posted @ 2022-06-24 15:33 一个不知道干嘛的小萌新 阅读(413) 评论(0) 推荐(0)
摘要:1.demo.c #include <stdlib.h> #include <stdio.h> #include <unistd.h> int main(void) { int cnt = 0; int fd = 0; char name[64]; while (1) { snprintf(name 阅读全文
posted @ 2022-06-14 20:22 一个不知道干嘛的小萌新 阅读(186) 评论(0) 推荐(0)