64,648
社区成员
发帖
与我相关
我的任务
分享
//log.cpp
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
char ca_file[256]={0};
int sp1();
class LogInfo
{
string sExeName_;
public:
LogInfo(const char *exeName = "");
};
//主函数
int main()
{
sp1();
return 0;
}
LogInfo::LogInfo(const char *exeName)
{
sExeName_ = exeName;
}
//测试函数
int sp1()
{
char char1[512]={0};
strcpy(ca_file, "test");
sprintf(char1, "%s_%s%d.log", ca_file, sExeName_.c_str(), 0);
ofstream of(char1, ios::out | ios::app);
if(!of)
{
return 1;
}
else
{
return 0;
}
}