User Tools

Site Tools


c_-_c_files:append_to_a_binary_file

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.txt · Last modified: 2020/07/15 10:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki