#include "windows.h"
using namespace std;
#include <stdio.h>
#include <time.h>
int main()
{
time_t timer = time(NULL);
printf("ctime is %s\n",ctime(&timer));
char windowname[100];
sprintf(windowname,"window%d.jpg",ctime(&timer));
cout<<windowname<<endl;
return 0;
using namespace std;
#include <stdio.h>
#include <time.h>
int main()
{
time_t timer = time(NULL);
printf("ctime is %s\n",ctime(&timer));
char windowname[100];
sprintf(windowname,"window%d.jpg",ctime(&timer));
cout<<windowname<<endl;
return 0;
}
%d 出来的时间看不出当前是多少
查找电脑的时间并把图片保存成时间戳的方式
CTime tm = CTime::GetCurrentTime();
CString str = tm.Format("pics_living/%Y_%m_%d_%H_%M_%S.bmp");
cvSaveImage(str.GetBuffer(0),img_ori);