I created the following function to get Date Time string:
char *GetDateTime (int Format)
{
if (Format > 2) Format = 0;
double DateTimeNow;
int BufferLen;
char *DateTimeFormat [3] = { "%X %x" , //Time Date
"%x" , //Date
"%X" }; //Time
char *DateTimeBuffer = NULL;
GetCurrentDateTime (&DateTimeNow);
BufferLen = FormatDateTimeString (DateTimeNow, DateTimeFormat [Format], NULL, 0);
DateTimeBuffer = malloc (BufferLen + 1);
FormatDateTimeString (DateTimeNow, DateTimeFormat [Format], DateTimeBuffer, BufferLen + 1 );
return DateTimeBuffer;
}
I do not free 'DateTimeBuffer' because I need to pass out its content. I wonder if that memory clears itself. Please help.