date to constant char

In my application, I want to append the date to a file name.
My code so far is :

// To Get the date and put the month and day into a var called today
SYSTEMTIME st;
GetSystemTime(&st);
string today;
stringstream(today) << st.wMonth << st.wDay;

// I can't figure out how to append the date to a string
// that the rename command will accept
char oldname[] ="C:\\Program Files\\IBM\\LOTUS\\NOTES\\NOTES.INI";
char newname[] ="C:\\Program Files\\IBM\\LOTUS\\NOTES\\NOTES.INI" << today;

result= rename( oldname , newname );
if ( result == 0 )
puts ( "File successfully renamed" );
else
perror( "Error renaming file" );
1
2
3
4
5
6
7
8
9
10
SYSTEMTIME st;
GetSystemTime(&st);
std::string today;
std::ostringstream os;
os << today << st.wMonth << st.wDay;

std::string oldname = "C:\\Program Files\\IBM\\LOTUS\\NOTES\\NOTES.INI"
std::string newname = oldname + os.str();

rename(oldname.c_str(), newname.c_str());
Worked, thanks!
Topic archived. No new replies allowed.