Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

第十七周阅读程序四----seekg()tellg()

$
0
0
/*
* 程序的版权和版本声明部分
* Copyright (c)2013, 烟台大学计算机学院学生
* All rightsreserved.
* 文件名称:duchengxu.cpp
* 作 者:赵晓晨
* 完成日期:2013年06月21日
* 版本号:v1.0
* 对任务及求解方法的描述部分:略
* 输入描述:略
* 问题描述:略
*/
# 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;
}


结果:

 

作者:dongshidexiaohai 发表于2013-6-21 11:07:08 原文链接
阅读:2 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>