第16周-阅读程序4(2)
2016-06-17 17:33
155 查看
#include <fstream> using namespace std; int main () { long pos; ofstream outfile; outfile.open ("test.txt"); outfile.write ("This is an apple",16); pos=outfile.tellp(); outfile.seekp (pos-7); outfile.write (" sam",4); outfile.close(); return 0; }
运行结果:
知识点总结:
当我们写入一个文件,并要知道内置指针的当前位置时,用tellp()
相关文章推荐
- Android 创建Library Project(库项目)与引用操作
- Qt Creator error: LNK1123: failure during conversion to COFF: file invalid or corrupt
- UiAutomator和Espresso比较
- php 学习网站
- Spring MVC 简单案例
- IBM MQ 命令(2)
- ToolBar的学习
- 编译lua,以及c和lua交叉使用
- 第十五周项目二 洗牌
- 签名Android应用程序
- Nginx服务器的搭建
- 财政一些概念
- 【操作系统】实验四 主存空间的分配和回收
- 曲演杂坛--为什么SELECT语句会被其他SELECT阻塞?
- ios开发——AirPlay相关文章
- 几何校正;正射校正;几何配准;影像配准,空间配准;辐射定标;大气校正;辐射校正的概念
- I2C设备地址详解
- PHP多线程数据交叉存储 防止读取重复数据
- 剑指offer(33)-两个链表的第一个公共结点
- 首次进入APP透明提示效果