第16周閱讀程序——4(2)

/*
*Copyright (c) 2016,煙臺大學計算機學院
*All rights reserved.
*文件名稱 :
*作 者 : 劉雲
*完成日期 : 2016年6月15號
*版 本 號 : v6.0
*
*問題描述 :  閱讀程序
*輸入描述 :無
*程序輸出 :
*/
#include<iostream>
#include<fstream>
using namespace std;
const char * filename ="a.txt";
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;
}

發佈了155 篇原創文章 · 獲贊 77 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章