CodePudding user response:
Localtime, time function check and ctimeThe following for your reference ~
# include & lt; Time. H>
Char * asctime (const struct tm * tm);
* (const char * asctime_r struct tm tm, char * buf);
(const char * ctime time_t * timep);
(const char * ctime_r time_t * timep, char * buf);
* * struct tm gmtime (const time_t timep);
Struct tm * gmtime_r (const timep time_t * and * struct tm result);
* struct tm localtime (const time_t * timep);
* localtime_r struct tm (const timep time_t * and * struct tm result);
Time_t mktime (* struct tm tm);
CodePudding user response:
First gets the current time, the simple check C API to know, and then the time together to write the content of the TXT fileCodePudding user response: