I feel like I've tried everything, I can get the first file to append to the second but cannot get the second file into a third. What am I doing wrong?
To be clear I need to take one file, append it to a second file, then put the contents of that second file into a third. I was able to simulate this outcome by putting both files into strings and then putting those strings into a third file, but that's not 'correct' in this problem.
I'm not particular to any way or any technique, I've tried a few and nothing works. This is the latest attempt, still doesn't work for the last step.
Here's my code:
#include <iostream>
#include <string> 
#include <fstream>
using namespace std;
int main()
{
    string a,b,c;
    cout << "Enter 3 file names: ";
    cin >> a >> b >> c;
    fstream inf;
    ifstream two;
    fstream outf;
    string content = "";
    string line = "";
    int i;
    string ch;
    inf.open(a, ios::in | ios:: out | ios::app);
    two.open(b);
    outf.open(c, ios::in);
    //check for errors
if (!inf)
    {
    cerr << "Error opening file" << endl;
    exit(1);
     } 
if (!two)
    {
    cerr << "Error opening file" << endl;
    exit(1);
    } 
if (!outf)
    {
    cerr << "Error opening file" << endl;
    exit(1);
    } 
 for(i=0; two.eof() != true; i++)
        content += two.get();
    i--;
    content.erase(content.end()-1);
    two.close();
    inf << content;
    inf.clear();
    inf.swap(outf);
    outf.close();
    inf.close();
    return 0;
 
    