国外做游戏的视频网站,百度竞价项目,国外做ui的网站j,做公司 网站建设文章目录 前言一、文件的随机读写1.1 fseek()1.2 ftell()1.3 rewind() 总结 前言
本篇文章介绍c语言中文件的随机读写 一、文件的随机读写
1.1 fseek()
fseek()函数的作用是根据文件指针的位置和偏移量定位文件指针
int fseek ( FILE * stream, long int offset, int origi… 文章目录 前言一、文件的随机读写1.1 fseek()1.2 ftell()1.3 rewind() 总结 前言
本篇文章介绍c语言中文件的随机读写 一、文件的随机读写
1.1 fseek()
fseek()函数的作用是根据文件指针的位置和偏移量定位文件指针
int fseek ( FILE * stream, long int offset, int origin );参数说明
stream要定位的文件指针offset偏移量orgin orgin的取值为一个常量
常量位置SEEK_SET文件起始位置SEEK_CUR文件指针当前位置SEEK_END文件末尾
1.2 ftell()
返回文件指针相对于起始位置的偏移量
long int ftell ( FILE * stream );1.3 rewind()
让文件指针回到文件的起始位置
void rewind ( FILE * stream );总结