How to log date and time
-
Hi I would like to know how to log the date and time and retrieve them at later stage. Someone books to attend a conference i want to log the exact time and date the booking whas made. Do i use the time class and just somehow write these to a file or how do i do that. many thanks Education begins a gentleman, conversation completes him ;)
-
Hi I would like to know how to log the date and time and retrieve them at later stage. Someone books to attend a conference i want to log the exact time and date the booking whas made. Do i use the time class and just somehow write these to a file or how do i do that. many thanks Education begins a gentleman, conversation completes him ;)
CTime class. You can get the lot. I usely get the year, month ... in integer and set them via the Format function of CString in a CString (like: yyyy/mm/dd hh/mimi/ss) Have Fun, "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
-
Hi I would like to know how to log the date and time and retrieve them at later stage. Someone books to attend a conference i want to log the exact time and date the booking whas made. Do i use the time class and just somehow write these to a file or how do i do that. many thanks Education begins a gentleman, conversation completes him ;)
#include <ofstream>
void LogMessage (LPCTSTR strMessage) {
std::ostream OutputFile("C:\\MyFolder\\My_log_file.txt");
CTime CurrentTime = CTime::GetCurrentTime();
CString TimeMrk = "[" + CurrentTime.Format("%H:%M:%S") + "] ";OutputFile << TimeMrk << strMessage; //Logging the message into the file, with the format (for example) : "\[18:12:34\] Message to log..."
}
TOXCCT >>> GEII power