// page224.cpp : 定义控制台应用程序的入口点。
//C++ 面向对象程序设计
//将数据追加到data.txt文件的末尾
#include "stdafx.h"
#include <iostream>
#include <fstream>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
int a;
cout << "Opening data.txt for appending.\n";
ofstream fout;
fout.open("data.txt" , ios::app);
if (fout.fail())
{
cout << " Inpout file opening failed.\n ";
exit(1);
}
fout << "5 6 pick up sticks .\n"
<< " 7 8 ain`t C++ great ! \n";
fout.close();
cout << " End of appending to file.\n";
cin >> a ;
return 0;
}
这几天敲的代码都放上来啦==呵呵 === 记录我的学习