- #include <time.h>
- #include <stdio.h>
- void main()
- {
- time_t timep;
- struct tm *p;
- char filename[100];
- for (int count=1;count<13;count++)
- {
- time(&timep);
- p=localtime(&timep);
- sprintf(filename,"[%d-%02d-%02d]-[%02d-%02d-%02d].264",(1900+p->tm_year),( 1+p->tm_mon), p->tm_mday,p->tm_hour, p->tm_min, p->tm_sec);
- printf("%s\n",filename);
- FILE* fout = fopen(filename,"wb");
- if (!fout)
- {
- printf("\ncan not create file!\n");
- return ;
- }
- fclose(fout);
- Sleep(3000);
- }
- }
以时间命名文件
最新推荐文章于 2023-07-07 13:21:56 发布