#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ofstream outFile("FileWriter.out");
if(outFile.fail()){
cerr<<"Unable to open file for writing."<<endl;
exit(1);
}
outFile<<"Hello!"<<endl;
outFile.close();
ofstream appendFile("FileWrite.out",ios_base::app);
if(appendFile.fail()){
cerr<<"Unable to open file for writing."<<endl;
exit(1);
}
appendFile<<"Append!"<<endl;
appendFile.close();
}
#include<fstream>
using namespace std;
int main()
{
ofstream outFile("FileWriter.out");
if(outFile.fail()){
cerr<<"Unable to open file for writing."<<endl;
exit(1);
}
outFile<<"Hello!"<<endl;
outFile.close();
ofstream appendFile("FileWrite.out",ios_base::app);
if(appendFile.fail()){
cerr<<"Unable to open file for writing."<<endl;
exit(1);
}
appendFile<<"Append!"<<endl;
appendFile.close();
}
No comments:
Post a Comment