This is a shortend down version of what I'm doing:
Code:
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <string>
#include <io.h>
using namespace std;
string month;
string day;
string year;
string weekday;
//The following are the functions for the different htm's
/////////////////////////////////////////////////////
//Function that prepares finalcwchartlist
/////////////////////////////////////////////////////
void cwchartlistfinal(ifstream& in_stream, ofstream& out_stream)
{
char next;
in_stream.get(next);
while (! in_stream.eof())
{
if (next == '*')
out_stream << "";
else
if (next == '@')
{out_stream << month;
}
else
if (next == '$')
{ out_stream << day;
}
else
if (next == '!')
{
out_stream << year;
}
else
if (next == '^')
{
out_stream << weekday;
}
else
out_stream << next;
in_stream.get(next);
}
}
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
int main(int argc, char * argv[])
{
/*
cout << "ChartList Creator \n";
cout << " Enter Month:";
cin >> month;
cout << " Enter Day: ";
cin >> day;
cout << " Enter Year: ";
cin >> year;
cout << " Enter Day of the Week: ";
cin >> weekday;
*/
month = argv[1];
day = argv [2];
year = argv [3];
weekday = argv [4];
//////////////////////////////////////////////////////
// Edits newcwchartlist for the internet
/////////////////////////////////////////////////////
ifstream finnewcwchartlist;
ofstream foutfinalcwchartlist;
cout << "Begin editing cwchartlist.\n";
finnewcwchartlist.open("newcwchartlist.htm");
if (finnewcwchartlist.fail())
{
cout << "newcwchartlist opening failed.\n";
exit(1);
}
foutfinalcwchartlist.open("finalcwchartlist.htm");
if (foutfinalcwchartlist.fail())
{
cout << "finalcwchartlist opening failed.\n";
exit(1);
}
cwchartlistfinal(finnewcwchartlist, foutfinalcwchartlist);
finnewcwchartlist.close();
foutfinalcwchartlist.close();
cout << "End of editing finalcwchartlist.\n";
///////////////////////////////////////////////////////
return 0;
}
I run this 14 times, but with different file names. I don't understand what the problem could be, after the files are closed, they shouldn't take up anymore space right?