This is the code I have so far:
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
string date;
//The following are the functions for the different htm's
/////////////////////////////////////////////////////
//Adds New Date to cwchartlist function
/////////////////////////////////////////////////////
void cwchartlist(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 << "Amperage " << date << "* </p>";
out_stream << endl;
out_stream << "@";
}
else
if (next == '$')
{ out_stream << "kVAR/kVA " << date << "* </p>";
out_stream << endl;
out_stream << "$";
}
else
out_stream << next;
in_stream.get(next);
}
}
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
int main()
{
cout << "Enter Date: ";
cin >> date;
//////////////////////////////////////////////////////
// Adds New Date to cwchartlist
/////////////////////////////////////////////////////
ifstream fincwchartlist;
ofstream foutnewcwchartlist;
cout << "Begin editing cwchartlist.\n";
fincwchartlist.open("cwchartlist.htm");
if (fincwchartlist.fail())
{
cout << "cwchartlist opening failed.\n";
exit(1);
}
foutnewcwchartlist.open("newcwchartlist.htm");
if (foutnewcwchartlist.fail())
{
cout << "newcwchartlist opening failed.\n";
exit(1);
}
cwchartlist(fincwchartlist, foutnewcwchartlist);
fincwchartlist.close();
foutnewcwchartlist.close();
cout << "End of editing newcwchartlist.\n";
///////////////////////////////////////////////////////
return 0;
}
Okay, this code works fine, but what I want to do is instead of looking for a symbol like "@" I want to search for "ampdate" or something similiar and replace it with the date "02-19-02.
Or is what i'm trying to do impossible?
Thank you
Bryan