C++使用系统时间作为文件名,创建不了
#include<time.h>#include<stdio.h>#include<iostream>#include<fstream>std::ofstreamSave...
#include <time.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
std::ofstream SaveFile;
int main( void )
{
time_t rawtime;
time(&rawtime);
char tmp[64];
strftime( tmp, sizeof(tmp), "%Y年%m月第%d天%X.txt",localtime(&rawtime) );
puts( tmp );
getchar();
SaveFile.open(tmp);
if(!SaveFile.is_open())system("pause");
return 0;
} 展开
#include <stdio.h>
#include <iostream>
#include <fstream>
std::ofstream SaveFile;
int main( void )
{
time_t rawtime;
time(&rawtime);
char tmp[64];
strftime( tmp, sizeof(tmp), "%Y年%m月第%d天%X.txt",localtime(&rawtime) );
puts( tmp );
getchar();
SaveFile.open(tmp);
if(!SaveFile.is_open())system("pause");
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询