Need a new way to replace a constant
This is a program I wrote to replace a symbol with a date in specialized htm files. It works, but every time I run it I have to run the replace all command to replace the date. Is there a way to make it so I can have the date be a variable I enter when I start the program, so I don't have to keep compiling it before I run it each time. The date in this case is 102601. Any help you can offer would be greatly appreciated. Thank you
#include <fstream.h>
#include <iostream.h>
#include <stdlib.h>
//The following are the functions for the different htm's
/////////////////////////////////////////////////////
//cw3amp date replace function
/////////////////////////////////////////////////////
void cw3amp(ifstream& in_stream, ofstream& out_stream)
{
char next;
in_stream.get(next);
while (! in_stream.eof())
{
if (next == '@')
out_stream << "102601";
else
out_stream << next;
in_stream.get(next);
}
}
//////////////////////////////////////////////////////
int main()
{
//////////////////////////////////////////////////////
// This is for cw3amp
/////////////////////////////////////////////////////
ifstream fin3amp;
ofstream fout3amp;
cout << "Begin editing cw3amp070901.\n";
fin3amp.open("cw3amp070901.htm");
if (fin3amp.fail())
{
cout << "cw3amp070901 opening failed.\n";
exit(1);
}
fout3amp.open("cw3amp.htm");
if (fout3amp.fail())
{
cout << "cw3amp opening failed.\n";
exit(1);
}
cw3amp(fin3amp, fout3amp);
fin3amp.close();
fout3amp.close();
cout << "End of editing cw3amp.\n";
///////////////////////
return 0;
}