//SEEK_SET 文件头开始偏移
//SEEK_CUR 当前位置开始偏移
//SEEK_END 末尾开始偏移
FILE* file_pointer = fopen("./text.txt", "r+");
fseek(file_pointer, sizeof(struct Person) * 2, SEEK_SET);//到第三个人位置
fseek(file_pointer, -(long)sizeof(struct Person) * 2, SEEK_END);//到第二个人位置
rewind(file_pointer);//文件指针置为开头
ftell(file_pointer);//返回文件指针位置
02-13
366
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交