当前位置: 首页> 汽车> 车展 > 装修图片效果图 现代简约_在线制作头像带字_3小时百度收录新站方法_pc端百度

装修图片效果图 现代简约_在线制作头像带字_3小时百度收录新站方法_pc端百度

时间:2025/7/10 17:14:54来源:https://blog.csdn.net/m0_59174039/article/details/147474323 浏览次数: 0次
装修图片效果图 现代简约_在线制作头像带字_3小时百度收录新站方法_pc端百度
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>int fd1 , fd2;
int ret;
char  buf[128] = {0};int main(void)
{fd1 = open("./test.txt",O_RDWR | O_TRUNC);if (-1 == fd1){perror("open error");return 1;}fd2  = dup(fd1);if (-1 == fd2){/* code */perror("dup error");close(fd1);return 1;}ret  = write(fd2,"tammy666",9);if (-1 == ret){/* code */perror("write error");close(fd1);close(fd2);return 1;}lseek(fd2,0,SEEK_SET);//2.在这里使用lseek指针,将读写指针移动到文件头即可,fd1 fd2用的都是一个读写指针,因此将lseek函数指向谁都可以。ret = read(fd2,buf,9);if (-1 == ret){/* code */perror("read error");close(fd1);close(fd2);return 1;}printf("read: %s\n",buf);   //1.注意这里read 读取到的是一个空字符串,因为读写指针移到了文件末尾close(fd1);close(fd2);return 0;
}

运行结果:

关键字:装修图片效果图 现代简约_在线制作头像带字_3小时百度收录新站方法_pc端百度

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: