Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <time.h>
- #include <stdio.h>
- using namespace std;
- int main(){
- time_t t = time(NULL);
- struct tm tm = *localtime(&t);
- char filename[50] = {0};
- sprintf(filename, "filename_%d.%d.%d_%d-%d-%d.log", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
- FILE *pFile;
- pFile = fopen(filename, "w");
- fprintf(pFile, filename);
- fclose(pFile);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement