#include <stdio.h> #include <time.h> int main() { time_t rawtime; struct tm *timeinfo; char buffer[100]; time(&rawtime); timeinfo = localtime(&rawtime); strftime(buffer, 100, "result-%Y_%m_%d_%H_%M_%S.jpg", timeinfo); puts(buffer); return 0; }
#include <stdio.h> #include <time.h> int main() { time_t rawtime; struct tm *timeinfo; char buffer[100]; time(&rawtime); timeinfo = localtime(&rawtime); strftime(buffer, 100, "result-%Y_%m_%d_%H_%M_%S.jpg", timeinfo); puts(buffer); return 0; }