User Tools

Site Tools


c_-_c_files:append_to_a_binary_file

This is an old revision of the document!


C - C++ Files - Append to a binary file

#include <iostream>
#include <fstream>
 
using namespace std;
 
int main()
{
  ofstream outFile("ForgetCodeWrite.out");
 
  if (outFile.fail()) 
  {
    cerr << "Unable to open file for writing." << endl;
    exit(1);
  }
 
  outFile << "ForgetCode!" << endl;
 
  outFile.close();
 
  ofstream appendFile("ForgetCodeWrite.out", ios_base::app);
 
  if (appendFile.fail()) 
  {
    cerr << "Unable to open file for writing." << endl;
    exit(1);
  }
 
  appendFile << "Appending Features!!" << endl;
 
  appendFile.close();
}
c_-_c_files/append_to_a_binary_file.1507819866.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki