//
// Fursin Program - Class CFStatus for the status of task
//

#include "FStatus.h"

#include <stdio.h> //For "remove of file" procedure
#include <string.h>
#include <fstream.h>
#include <iostream.h>

CFStatus::CFStatus(char *NameOfFile)
{
	ifstream fin;
	
	FName=new char[strlen(NameOfFile)*2];
	strcpy(FName, NameOfFile);

	fin.open(FName,ios::nocreate|ios::in);
	
	if (fin)
	{
		fin.close();
		remove(FName);
	}
}

void CFStatus::Set(char *status1, char *status2, bool out)
{
	ofstream fout;
	
	fout.open(FName);
	if (fout!=NULL)
	{
		fout << status1 << '\n';
		fout << status2 << '\n';

		fout.close();
		
		if (out)
		{
			cout << '\n';
			cout << status1 << '\n';
			cout << status2 << '\n';
		}
	}
}
