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