We write software, always want to change the program can automatically generate version number, do not manually to change, so much convenient ah. The VS compiler can implement this functionality. as follows:
[CPP] View Plain copy /* get program compile time, used to automatically generate version numbers well __DATE__ "mar 25 2013 " " mar 1 2013 " __time__ "21:42:20" */ Void getprogramcompiletime ( systemtime &st) { tchar szdate[20]; zeromemory (szDate, sizeof ( szdate)); zeromemory (&st, sizeof (SYSTEMTIME)); _stprintf (Szdate, text ("%s"), __date__); st.wyear = _tcstoul (szdate+7, 0, 10); st.wday = szdate[5] - text (' 0 '); if (Szdate[4] != text (' ')) { st.wDay += (Szdate[4] - text (' 0 ')) * 10; } switch (szdate[0]) { case text (' A '): if (Szdate[1] == text (' P ')) { st.wMonth = 4; } else { st.wmonth = 8; } break; case text (' D '): st.wMonth = 12; break; case text (' F '): st.wmonth = 2; break; case text (' J '): if (Szdate[1] == text (' a ')) { st.wMonth = 1; } else { if (Szdate[2] == text (' n '))