/*
Program: LabTestA.cpp
Purpose: Combine video clips to make a video file
Author:  Michael J. Sepoct
*/

#include <iostream>
#include <fstream>
using namespace std;

void makeCopy(int option);

void main()
{
	int option;

	cout << "What do you want to do?\n";
	cout << "    1. Do you want a file containing the first two parts of the movie?\n";
	cout << "    2. Do you want a file containing the three parts of the movie?\n";
	cout << "Choose a number.\n";
	cin >> option;
	
	makeCopy(option);
	
	cout << endl;
}

void makeCopy(int option)
{
	ifstream inOne, inTwo, inThree;
	ofstream outf;
	char c;

	inOne.open("TAPart1.wmv",ios::binary);
	
	if (option == 1)
		outf.open("TBCopy1.wmv",ios::binary);
	else
		outf.open("TBCopy.wmv",ios::binary);

	inOne.read((char *)&c,sizeof(c));
	
	while (!inOne.eof())
	{
		outf.write((char *)&c,sizeof(c));
		inOne.read((char *)&c,sizeof(c));
	}
	
	inOne.close();
	inTwo.open("TAPart2.wmv",ios::binary);
	
	inTwo.read((char *)&c,sizeof(c));
	
	while (!inTwo.eof())
	{
		outf.write((char *)&c,sizeof(c));
		inTwo.read((char *)&c,sizeof(c));
	}

	inTwo.close();

	if (option == 2)
	{
		inThree.open("TAPart3.wmv",ios::binary);
		
		inThree.read((char *)&c,sizeof(c));
		while (!inThree.eof())
		{
			outf.write((char *)&c,sizeof(c));
			inThree.read((char *)&c,sizeof(c));
		}
		
		inThree.close();
	}
	
	outf.close();
}