Q. Append Filename with GMT Date

Thanks in advance for any help.

My problem is this: I would like to start a new file with the filename having the date appended onto it, at 0000 hours GMT. I am trying to use _gmtime64. I am a begining C++ coder.

Here is what I have tried so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
void BotActvityLogging(char* filepath, char* ActivityLog)
     {
	 string str;
	
		//The asctime function converts a time stored as a structure to a character string. 
		//The _tm value is usually obtained from a call to gmtime or localtime.
		//Both functions can be used to fill in a tm structure, as defined in TIME.H. 

	  string strGMT = (asctime_s (char* buffer, size_t 64, const struct tm *_gmtime64(const_time64_t *_Time))); // size_t: Result of sizeof operator.
	  str.append (strGMT, 4, 5);
      fstream filestr;
      filestr.open (filepath, fstream::in | fstream::out | fstream::app);
      
      if (str != str.append)
      {
      str = str.append
      }
      
      filestr<<ActivityLog<<str<<endl; // Need GMT Date appended here.
     }


I know there are bugs with it but I cannot figure out what they are. Can someone put be back on the path to righteousness?
Last edited on
Can you describe in Plain English what lines 14-17 are supposed to do?
Topic archived. No new replies allowed.