fseek
2015-12-11 11:15
183 查看
详情请看 http://www.cplusplus.com/reference/cstdio/fseek/
(1) fseek()
功能:重新设置stream的位置到offset处基于文件头/文件尾/当前位置
参数:stream: 只想一个文件对象的指针.
offset: 二进制文件: Number of bytes to offset from origin. 文本文件: Either zero, or a value returned byftell.
origin: 偏移基于的位置.
It is specified by one of the following constants defined in<cstdio> exclusively to be used as arguments for this function:
*
Library implementations are allowed to not meaningfully support SEEK_END (therefore, code using it has no real standard portability).
返回值: 成功返回0 失败返回非0
(
(1) fseek()
定义: int fseek ( FILE * stream, long int offset, int origin );
功能:重新设置stream的位置到offset处基于文件头/文件尾/当前位置
参数:stream: 只想一个文件对象的指针.
offset: 二进制文件: Number of bytes to offset from origin. 文本文件: Either zero, or a value returned byftell.
origin: 偏移基于的位置.
It is specified by one of the following constants defined in<cstdio> exclusively to be used as arguments for this function:
Constant | Reference position |
---|---|
SEEK_SET | 文件头 |
SEEK_CUR | 当前位置 |
SEEK_END | 文件 |
Library implementations are allowed to not meaningfully support SEEK_END (therefore, code using it has no real standard portability).
返回值: 成功返回0 失败返回非0
/* fseek example */ #include <stdio.h> int main () { FILE * pFile; pFile = fopen ( "example.txt" , "wb" ); fputs ( "This is an apple." , pFile ); fseek ( pFile , 9 , SEEK_SET ); fputs ( " sam" , pFile ); fclose ( pFile ); return 0; }
(
相关文章推荐
- 6.mr中理解分区和分组
- 资源访问机制之资源定义与解析流程
- 理解jquery的$.extend()、$.fn和$.fn.extend()
- SlidingMenuc侧滑菜单
- java.util.ConcurrentModificationException问题解决
- iOS-上传错误之ERROR ITMS-90535 Unexpected CFBundleExecutable Key. 的解决办法
- js获取一个对象的所以属性和值
- 违反约束或者主外键删除数据
- 图像滤镜艺术---保留细节的磨皮滤镜之PS实现
- extjs 事件参数,不加,就要使用绝对引用
- APUE学习第一章
- MyEclipse项目提交到Git@OSC简单示例
- 5.MR多文件的输入输出
- springMVC 返回类型选择 以及 SpringMVC中model,modelMap.request,session取值顺序
- 调用天气预报代码
- spfa ,就邻接表建图模板
- 单线程无锁读写缓存
- UIAlertView浅谈
- 创建显示对话框的DLL
- bukket插件例子(2)编译