C++獲取時間並命名為文件名


#include <time.h>

char pStrPath1[20];
time_t currTime;
struct tm *mt;
Mat saveImg1;

currTime = time(NULL);
mt = localtime(&currTime);
/*根據日期生成文件名*/
sprintf(pStrPath1, "D:\\images\\face\\yr0905\\%d%02d%02d%02d%02d%02d.jpg", mt->tm_year + 1900, mt->tm_mon + 1, mt->tm_mday, mt->tm_hour, mt->tm_min, mt->tm_sec);
imwrite(pStrPath1, saveImg1);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM